Change cache directory name to include `pytest`
This commit is contained in:
parent
b8be339632
commit
a24ca9872f
1
AUTHORS
1
AUTHORS
|
@ -6,6 +6,7 @@ Contributors include::
|
||||||
Abdeali JK
|
Abdeali JK
|
||||||
Abhijeet Kasurde
|
Abhijeet Kasurde
|
||||||
Ahn Ki-Wook
|
Ahn Ki-Wook
|
||||||
|
Alan Velasco
|
||||||
Alexander Johnson
|
Alexander Johnson
|
||||||
Alexei Kozlenok
|
Alexei Kozlenok
|
||||||
Anatoly Bubenkoff
|
Anatoly Bubenkoff
|
||||||
|
|
|
@ -114,7 +114,8 @@ class LFPlugin(object):
|
||||||
mode = "run all (no recorded failures)"
|
mode = "run all (no recorded failures)"
|
||||||
else:
|
else:
|
||||||
noun = 'failure' if self._previously_failed_count == 1 else 'failures'
|
noun = 'failure' if self._previously_failed_count == 1 else 'failures'
|
||||||
suffix = " first" if self.config.getvalue("failedfirst") else ""
|
suffix = " first" if self.config.getvalue(
|
||||||
|
"failedfirst") else ""
|
||||||
mode = "rerun previous {count} {noun}{suffix}".format(
|
mode = "rerun previous {count} {noun}{suffix}".format(
|
||||||
count=self._previously_failed_count, suffix=suffix, noun=noun
|
count=self._previously_failed_count, suffix=suffix, noun=noun
|
||||||
)
|
)
|
||||||
|
@ -185,7 +186,7 @@ def pytest_addoption(parser):
|
||||||
'--cache-clear', action='store_true', dest="cacheclear",
|
'--cache-clear', action='store_true', dest="cacheclear",
|
||||||
help="remove all cache contents at start of test run.")
|
help="remove all cache contents at start of test run.")
|
||||||
parser.addini(
|
parser.addini(
|
||||||
"cache_dir", default='.cache',
|
"cache_dir", default='.pytest_cache',
|
||||||
help="cache directory path.")
|
help="cache directory path.")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Change default cache directory name from `.cache` to `.pytest_cache`
|
|
@ -31,7 +31,7 @@ class TestNewAPI(object):
|
||||||
|
|
||||||
def test_cache_writefail_cachfile_silent(self, testdir):
|
def test_cache_writefail_cachfile_silent(self, testdir):
|
||||||
testdir.makeini("[pytest]")
|
testdir.makeini("[pytest]")
|
||||||
testdir.tmpdir.join('.cache').write('gone wrong')
|
testdir.tmpdir.join('.pytest_cache').write('gone wrong')
|
||||||
config = testdir.parseconfigure()
|
config = testdir.parseconfigure()
|
||||||
cache = config.cache
|
cache = config.cache
|
||||||
cache.set('test/broken', [])
|
cache.set('test/broken', [])
|
||||||
|
@ -39,14 +39,14 @@ class TestNewAPI(object):
|
||||||
@pytest.mark.skipif(sys.platform.startswith('win'), reason='no chmod on windows')
|
@pytest.mark.skipif(sys.platform.startswith('win'), reason='no chmod on windows')
|
||||||
def test_cache_writefail_permissions(self, testdir):
|
def test_cache_writefail_permissions(self, testdir):
|
||||||
testdir.makeini("[pytest]")
|
testdir.makeini("[pytest]")
|
||||||
testdir.tmpdir.ensure_dir('.cache').chmod(0)
|
testdir.tmpdir.ensure_dir('.pytest_cache').chmod(0)
|
||||||
config = testdir.parseconfigure()
|
config = testdir.parseconfigure()
|
||||||
cache = config.cache
|
cache = config.cache
|
||||||
cache.set('test/broken', [])
|
cache.set('test/broken', [])
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.platform.startswith('win'), reason='no chmod on windows')
|
@pytest.mark.skipif(sys.platform.startswith('win'), reason='no chmod on windows')
|
||||||
def test_cache_failure_warns(self, testdir):
|
def test_cache_failure_warns(self, testdir):
|
||||||
testdir.tmpdir.ensure_dir('.cache').chmod(0)
|
testdir.tmpdir.ensure_dir('.pytest_cache').chmod(0)
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
def test_error():
|
def test_error():
|
||||||
raise Exception
|
raise Exception
|
||||||
|
@ -127,7 +127,7 @@ def test_cache_reportheader(testdir):
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest("-v")
|
result = testdir.runpytest("-v")
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
"cachedir: .cache"
|
"cachedir: .pytest_cache"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,8 +201,8 @@ class TestLastFailed(object):
|
||||||
])
|
])
|
||||||
|
|
||||||
# Run this again to make sure clear-cache is robust
|
# Run this again to make sure clear-cache is robust
|
||||||
if os.path.isdir('.cache'):
|
if os.path.isdir('.pytest_cache'):
|
||||||
shutil.rmtree('.cache')
|
shutil.rmtree('.pytest_cache')
|
||||||
result = testdir.runpytest("--lf", "--cache-clear")
|
result = testdir.runpytest("--lf", "--cache-clear")
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
"*1 failed*2 passed*",
|
"*1 failed*2 passed*",
|
||||||
|
@ -495,15 +495,15 @@ class TestLastFailed(object):
|
||||||
# Issue #1342
|
# Issue #1342
|
||||||
testdir.makepyfile(test_empty='')
|
testdir.makepyfile(test_empty='')
|
||||||
testdir.runpytest('-q', '--lf')
|
testdir.runpytest('-q', '--lf')
|
||||||
assert not os.path.exists('.cache')
|
assert not os.path.exists('.pytest_cache')
|
||||||
|
|
||||||
testdir.makepyfile(test_successful='def test_success():\n assert True')
|
testdir.makepyfile(test_successful='def test_success():\n assert True')
|
||||||
testdir.runpytest('-q', '--lf')
|
testdir.runpytest('-q', '--lf')
|
||||||
assert not os.path.exists('.cache')
|
assert not os.path.exists('.pytest_cache')
|
||||||
|
|
||||||
testdir.makepyfile(test_errored='def test_error():\n assert False')
|
testdir.makepyfile(test_errored='def test_error():\n assert False')
|
||||||
testdir.runpytest('-q', '--lf')
|
testdir.runpytest('-q', '--lf')
|
||||||
assert os.path.exists('.cache')
|
assert os.path.exists('.pytest_cache')
|
||||||
|
|
||||||
def test_xfail_not_considered_failure(self, testdir):
|
def test_xfail_not_considered_failure(self, testdir):
|
||||||
testdir.makepyfile('''
|
testdir.makepyfile('''
|
||||||
|
|
Loading…
Reference in New Issue