Skip to content

Commit 98dc5ca

Browse files
Actually remove the file even if the tests failed
Following review, see https://github.com/PyCQA/pylint/pull/4004\#discussion_r550774984
1 parent cdc43a9 commit 98dc5ca

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

tests/test_func.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ def __test_functionality(module_file, messages_file, dependencies):
168168
if len(sys.argv) > 1:
169169
FILTER_RGX = sys.argv[1]
170170
del sys.argv[1]
171-
pytest.main(sys.argv)
172-
if UPDATE_FILE.exists():
173-
UPDATE_FILE.unlink()
171+
try:
172+
pytest.main(sys.argv)
173+
finally:
174+
if UPDATE_FILE.exists():
175+
UPDATE_FILE.unlink()

tests/test_functional.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def test_functional(test_file, recwarn):
109109
if UPDATE_OPTION in sys.argv:
110110
UPDATE_FILE.touch()
111111
sys.argv.remove(UPDATE_OPTION)
112-
pytest.main(sys.argv)
113-
if UPDATE_FILE.exists():
114-
UPDATE_FILE.unlink()
112+
try:
113+
pytest.main(sys.argv)
114+
finally:
115+
if UPDATE_FILE.exists():
116+
UPDATE_FILE.unlink()

0 commit comments

Comments
 (0)