Skip to content

Commit cf14cc0

Browse files
committed
Switch from is_file to exists
1 parent f25705b commit cf14cc0

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

test/unit/nox/_artifacts_test.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -309,30 +309,20 @@ def test_all_files(tmp_path, capsys):
309309

310310

311311
class TestPrepareCoverageXml:
312-
def setup_method(self):
313-
for path in [Path(COVERAGE_FILE), Path(COVERAGE_XML)]:
314-
if path.exists():
315-
path.unlink()
316-
317-
def teardown_method(self):
318-
for path in [Path(COVERAGE_FILE), Path(COVERAGE_XML)]:
319-
if path.exists():
320-
path.unlink()
321-
322312
@staticmethod
323-
def test_no_coverage_file():
313+
def test_no_coverage_file_creates_dummy():
324314
_prepare_coverage_xml(Mock(), PROJECT_CONFIG.source)
325315

326-
assert Path(COVERAGE_XML).is_file()
316+
assert Path(COVERAGE_XML).exists()
327317
assert Path(COVERAGE_XML).read_text() == ""
328-
assert not Path(COVERAGE_FILE).is_file()
318+
assert not Path(COVERAGE_FILE).exists()
329319

330320
@staticmethod
331-
def test_with_bad_coverage_file_still_raises_error(capsys):
321+
def test_that_bad_coverage_file_still_raises_error(capsys):
332322
_create_coverage_file(Path(COVERAGE_FILE), COVERAGE_TABLES)
333323
session_mock = Mock()
334324

335325
_prepare_coverage_xml(session_mock, PROJECT_CONFIG.source)
336326

337-
assert Path(COVERAGE_FILE).is_file()
338-
assert not Path(COVERAGE_XML).is_file()
327+
assert Path(COVERAGE_FILE).exists()
328+
assert not Path(COVERAGE_XML).exists()

0 commit comments

Comments
 (0)