@@ -88,27 +88,23 @@ def test_cachefuncarg(cache):
88
88
result .stdout .fnmatch_lines (["*1 passed*" ])
89
89
90
90
def test_custom_cache_dirname (self , testdir ):
91
+ cache_dir = 'custom_cache_dirname'
91
92
testdir .makeini ("""
92
93
[pytest]
93
- cache_dirname = custom_cache_dirname
94
- """ )
94
+ cache_dir = {cache_dir}
95
+ """ . format ( cache_dir = cache_dir ) )
95
96
testdir .makepyfile (test_errored = 'def test_error():\n assert False' )
96
97
testdir .runpytest ()
97
- assert os .path .exists ('custom_cache_dirname' )
98
-
99
- @pytest .mark .parametrize ('custom_cache_dirname' , [
100
- pytest .param ('/tmp/mycache' , marks = pytest .mark .skipif (sys .platform == 'win32' ,
101
- reason = 'test for linux pathes' )),
102
- pytest .param ('~/mycache' , marks = pytest .mark .skipif (sys .platform == 'win32' ,
103
- reason = 'test for linux pathes' )),
104
- pytest .param ('C:\mycache' , marks = pytest .mark .skipif (sys .platform != 'win32' ,
105
- reason = 'test for win32 pathes' )),
106
- ])
107
- def test_cache_dirname_fail_on_abs (self , testdir , custom_cache_dirname ):
98
+ assert testdir .tmpdir .join (cache_dir ).isdir ()
99
+
100
+ @pytest .mark .parametrize ('cache_dir' , [
101
+ os .path .abspath ('tmp' ),
102
+ os .path .join ('~' , 'tmp' )])
103
+ def test_cache_dirname_fail_on_abs (self , testdir , cache_dir ):
108
104
testdir .makeini ("""
109
105
[pytest]
110
- cache_dirname = {custom_cache_dirname }
111
- """ .format (custom_cache_dirname = custom_cache_dirname ))
106
+ cache_dir = {cache_dir }
107
+ """ .format (cache_dir = cache_dir ))
112
108
pytest .raises (ValueError , "testdir.parseconfigure()" ,
113
109
message = "cache dirname must be relative path, not absolute" )
114
110
0 commit comments