Skip to content

Commit

Permalink
Added test for fail if cache_dirname is absolute path or home dir
Browse files Browse the repository at this point in the history
  • Loading branch information
RockBomber committed Jul 5, 2017
1 parent db359e7 commit cac1892
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions testing/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ def test_custom_cache_dirname(self, testdir):
testdir.runpytest()
assert os.path.exists('custom_cache_dirname')

@pytest.mark.parametrize('custom_cache_dirname', [
pytest.param('/tmp/mycache', marks=pytest.mark.skipif(sys.platform == 'win32',
reason='test for linux pathes')),
pytest.param('~/mycache', marks=pytest.mark.skipif(sys.platform == 'win32',
reason='test for linux pathes')),
pytest.param('C:\mycache', marks=pytest.mark.skipif(sys.platform != 'win32',
reason='test for win32 pathes')),
])
def test_cache_dirname_fail_on_abs(self, testdir, custom_cache_dirname):
testdir.makeini("""
[pytest]
cache_dirname = {}
""".format(custom_cache_dirname))
pytest.raises(ValueError, "testdir.parseconfigure()",
message="cache dirname must be relative path, not absolute")

def test_cache_reportheader(testdir):
testdir.makepyfile("""
Expand Down

0 comments on commit cac1892

Please sign in to comment.