Skip to content

Commit 6cc52c1

Browse files
committed
Fixed cache dir tests for requested changes
1 parent 3e7bf54 commit 6cc52c1

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

testing/test_cache.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,23 @@ def test_cachefuncarg(cache):
8888
result.stdout.fnmatch_lines(["*1 passed*"])
8989

9090
def test_custom_cache_dirname(self, testdir):
91+
cache_dir = 'custom_cache_dirname'
9192
testdir.makeini("""
9293
[pytest]
93-
cache_dirname = custom_cache_dirname
94-
""")
94+
cache_dir = {cache_dir}
95+
""".format(cache_dir=cache_dir))
9596
testdir.makepyfile(test_errored='def test_error():\n assert False')
9697
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):
108104
testdir.makeini("""
109105
[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))
112108
pytest.raises(ValueError, "testdir.parseconfigure()",
113109
message="cache dirname must be relative path, not absolute")
114110

0 commit comments

Comments
 (0)