summaryrefslogtreecommitdiff
path: root/tests/unit/utils
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/utils')
-rw-r--r--tests/unit/utils/test_utils.py22
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()