diff options
author | Axel Dahlberg <axel.dahlberg12@gmail.com> | 2021-01-18 12:00:07 +0100 |
---|---|---|
committer | Axel Dahlberg <axel.dahlberg12@gmail.com> | 2021-01-18 12:57:22 +0100 |
commit | 2d6d1dad4309aaaebdcb608bb46445fd62343a37 (patch) | |
tree | a0b844d8020583e1eca1fc24c3c0afa2405203fd /tests | |
parent | 799b0fb5c64abd6daa2887ddd7816a7ec51c343c (diff) | |
download | qutebrowser-2d6d1dad4309aaaebdcb608bb46445fd62343a37.tar.gz qutebrowser-2d6d1dad4309aaaebdcb608bb46445fd62343a37.zip |
Clearer assertions, updated tests to assert correct errors
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/utils/test_utils.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index 238e89736..06dd203c5 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -882,10 +882,13 @@ def test_mimetype_extension(mimetype, extension): class TestCleanupFileContext: - def test_no_file(self, tmp_path): + def test_no_file(self, tmp_path, caplog): tmpfile = tmp_path / 'tmp.txt' - with utils.cleanup_file(tmpfile): - pass + with caplog.at_level(logging.ERROR, 'misc'): + with utils.cleanup_file(tmpfile): + pass + assert len(caplog.messages) == 1 + assert caplog.messages[0].startswith("Failed to delete tempfile") assert not tmpfile.exists() def test_no_error(self, tmp_path): @@ -911,3 +914,5 @@ class TestCleanupFileContext: with caplog.at_level(logging.ERROR, 'misc'): with utils.cleanup_file(tmp_path): pass + assert len(caplog.messages) == 1 + assert caplog.messages[0].startswith("Failed to delete tempfile") |