File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
import shutil
3
+ import stat
3
4
import sys
4
5
import textwrap
5
6
@@ -45,14 +46,17 @@ def test_cache_writefail_cachfile_silent(self, testdir):
45
46
)
46
47
def test_cache_writefail_permissions (self , testdir ):
47
48
testdir .makeini ("[pytest]" )
49
+ mode = os .stat (testdir .tmpdir .ensure_dir (".pytest_cache" ))[stat .ST_MODE ]
48
50
testdir .tmpdir .ensure_dir (".pytest_cache" ).chmod (0 )
49
51
config = testdir .parseconfigure ()
50
52
cache = config .cache
51
53
cache .set ("test/broken" , [])
54
+ testdir .tmpdir .ensure_dir (".pytest_cache" ).chmod (mode )
52
55
53
56
@pytest .mark .skipif (sys .platform .startswith ("win" ), reason = "no chmod on windows" )
54
57
@pytest .mark .filterwarnings ("default" )
55
58
def test_cache_failure_warns (self , testdir ):
59
+ mode = os .stat (testdir .tmpdir .ensure_dir (".pytest_cache" ))[stat .ST_MODE ]
56
60
testdir .tmpdir .ensure_dir (".pytest_cache" ).chmod (0 )
57
61
testdir .makepyfile (
58
62
"""
@@ -62,6 +66,7 @@ def test_error():
62
66
"""
63
67
)
64
68
result = testdir .runpytest ("-rw" )
69
+ testdir .tmpdir .ensure_dir (".pytest_cache" ).chmod (mode )
65
70
assert result .ret == 1
66
71
# warnings from nodeids, lastfailed, and stepwise
67
72
result .stdout .fnmatch_lines (["*could not create cache path*" , "*3 warnings*" ])
You can’t perform that action at this time.
0 commit comments