diff options
author | Axel Dahlberg <axel.dahlberg12@gmail.com> | 2021-01-17 13:24:49 +0100 |
---|---|---|
committer | Axel Dahlberg <axel.dahlberg12@gmail.com> | 2021-01-17 13:24:49 +0100 |
commit | ed2c3ea45118cdb13ac001520b5684d4bb1ea2c3 (patch) | |
tree | 1dd50feb89ef8aeed7d6993ea2c82d85abcb7161 /tests/unit/utils/test_utils.py | |
parent | 0bfff1f718f55af84adfe60760437c5de2ea59d2 (diff) | |
download | qutebrowser-ed2c3ea45118cdb13ac001520b5684d4bb1ea2c3.tar.gz qutebrowser-ed2c3ea45118cdb13ac001520b5684d4bb1ea2c3.zip |
Update to test cleanup file context and ignore cover
Diffstat (limited to 'tests/unit/utils/test_utils.py')
-rw-r--r-- | tests/unit/utils/test_utils.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index 525b99550..74b49f573 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -882,27 +882,25 @@ def test_mimetype_extension(mimetype, extension): class TestCleanupFileContext: - def test_no_file(self, tmpdir): - tmpfile = tmpdir / 'tmp.txt' + def test_no_file(self, tmp_path): + tmpfile = tmp_path / 'tmp.txt' with utils.cleanup_file(tmpfile): pass - assert not os.path.exists(tmpfile) + assert not tmpfile.exists() - def test_no_error(self, tmpdir): - tmpfile = tmpdir / 'tmp.txt' + def test_no_error(self, tmp_path): + tmpfile = tmp_path / 'tmp.txt' with tmpfile.open('w'): pass with utils.cleanup_file(tmpfile): pass - assert not os.path.exists(tmpfile) + assert not tmpfile.exists() - def test_error(self, tmpdir): - tmpfile = tmpdir / 'tmp.txt' + def test_error(self, tmp_path): + tmpfile = tmp_path / 'tmp.txt' with tmpfile.open('w'): pass - try: + with pytest.raises(RuntimeError): with utils.cleanup_file(tmpfile): raise RuntimeError - except RuntimeError: - pass - assert not os.path.exists(tmpfile) + assert not tmpfile.exists() |