diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2017-11-04 14:00:26 +0000 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2017-11-04 14:00:26 +0000 |
commit | 7e26dca99354db00e4552efc2fe856de9b0ad798 (patch) | |
tree | 55f2298dca4218f6a5b0fd4349c63c8673e9a2ff | |
parent | dc0e2292152f86abce10daf3d728120307eac62b (diff) | |
parent | 62f729d5733d0a0025ae25b69a0c13057c7aa314 (diff) |
merge patched-unstable into unstable
-rw-r--r-- | debian/.git-dpm | 4 | ||||
-rw-r--r-- | debian/patches/fix_log_test_fails.diff | 95 | ||||
-rw-r--r-- | tests/pytest.ini | 1 | ||||
-rwxr-xr-x | tests/t1_backends.py | 19 |
4 files changed, 25 insertions, 94 deletions
diff --git a/debian/.git-dpm b/debian/.git-dpm index abe3c1e..87c78e9 100644 --- a/debian/.git-dpm +++ b/debian/.git-dpm @@ -1,6 +1,6 @@ # see git-dpm(1) from git-dpm package -1774c5a9a8904614031012f48df3142cf7f1468e -1774c5a9a8904614031012f48df3142cf7f1468e +62f729d5733d0a0025ae25b69a0c13057c7aa314 +62f729d5733d0a0025ae25b69a0c13057c7aa314 cff3c35a423c68dadec70a45a039c2db8dc19e32 cff3c35a423c68dadec70a45a039c2db8dc19e32 s3ql_2.24+dfsg.orig.tar.gz diff --git a/debian/patches/fix_log_test_fails.diff b/debian/patches/fix_log_test_fails.diff index ea87d10..2e6d896 100644 --- a/debian/patches/fix_log_test_fails.diff +++ b/debian/patches/fix_log_test_fails.diff @@ -1,85 +1,28 @@ -From 1774c5a9a8904614031012f48df3142cf7f1468e Mon Sep 17 00:00:00 2001 +From 62f729d5733d0a0025ae25b69a0c13057c7aa314 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath <Nikolaus@rath.org> Date: Sat, 4 Nov 2017 11:54:23 +0000 -Subject: Fix logging related bogus test failures +Subject: Fix bogus test failures due to stderr logging Origin: debian Forwarded: not-needed Patch-Name: fix_log_test_fails.diff -This patch works around a few bogus test failures. For some reason, the -tests ends up printing messages to stderr which causes the test -runner to believe that the test has failed. However, the messages -are actually expected - just not on stderr. - -This still needs to be debugged properly, but there doesn't seem to be -anything wrong with the tested components itself. +This patch disables the recently introduced python3-pytest-catchlog +"feature" of printing log messages to stderr by default. This causes +spurious test errors, because the test suite actually separately +inspects stderr for suspicious messages. Since it then sees messages +that were only expected in the logs, the test fails. --- - tests/t1_backends.py | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) + tests/pytest.ini | 1 + + 1 file changed, 1 insertion(+) -diff --git a/tests/t1_backends.py b/tests/t1_backends.py -index 3b5e5..afc92 100755 ---- a/tests/t1_backends.py -+++ b/tests/t1_backends.py -@@ -857,7 +857,7 @@ def test_list_bug(backend, monkeypatch): - - @pytest.mark.with_backend('s3c/aes+zlib', - require_mock_server=True) --def test_corrupted_get(backend, monkeypatch): -+def test_corrupted_get(backend, monkeypatch, reg_output): - key = 'brafasel' - value = b'hello there, let us see whats going on' - backend[key] = value -@@ -873,6 +873,10 @@ def test_corrupted_get(backend, monkeypatch): - return send_header_real(self, keyword, value) - monkeypatch.setattr(handler_class, 'send_header', send_header) - -+ # For some reason the log messages end up on stderr in some -+ # cases - ignore them. -+ reg_output(r'WARNING\b.*\bMD5 mismatch for brafasel', count=3) -+ - with assert_logs('^MD5 mismatch for', count=1, level=logging.WARNING): - assert_raises(BadDigestError, backend.fetch, key) - -@@ -882,7 +886,7 @@ def test_corrupted_get(backend, monkeypatch): - - @pytest.mark.with_backend('s3c/{raw,aes+zlib}', - require_mock_server=True) --def test_corrupted_meta(backend, monkeypatch): -+def test_corrupted_meta(backend, monkeypatch, reg_output): - key = 'brafasel' - value = b'hello there, let us see whats going on' - backend[key] = value -@@ -898,6 +902,10 @@ def test_corrupted_meta(backend, monkeypatch): - return send_header_real(self, keyword, value) - monkeypatch.setattr(handler_class, 'send_header', send_header) - -+ # For some reason the log messages end up on stderr in some -+ # cases - ignore them. -+ reg_output(r'WARNING\b.*\bMD5 mismatch in metadata for brafasel', count=3) -+ - with assert_logs('^MD5 mismatch in metadata for', count=1, level=logging.WARNING): - assert_raises(BadDigestError, backend.fetch, key) - -@@ -1259,7 +1267,7 @@ def test_expired_token_put(backend, monkeypatch): - - @pytest.mark.with_backend('s3c/{raw,aes+zlib}', - require_mock_server=True) --def test_conn_abort(backend, monkeypatch): -+def test_conn_abort(backend, monkeypatch, reg_output): - '''Close connection while sending data''' - - data = b'hello there, let us see whats going on' -@@ -1277,6 +1285,11 @@ def test_conn_abort(backend, monkeypatch): - self.close_connection = True - monkeypatch.setattr(handler_class, 'send_data', send_data) - -+ # For some reason the log messages end up on stderr in some -+ # cases - ignore them. -+ reg_output(r"WARNING\b.*\bObject closed prematurely, can't check MD5", -+ count=1) -+ - with pytest.raises(ConnectionClosed): - with assert_logs("^Object closed prematurely, can't check MD5", - count=1, level=logging.WARNING): +diff --git a/tests/pytest.ini b/tests/pytest.ini +index a87c1..eb029 100644 +--- a/tests/pytest.ini ++++ b/tests/pytest.ini +@@ -1,3 +1,4 @@ + [pytest] + addopts = --verbose --assert=rewrite --exitfirst --tb=native + python_files = t?_*.py ++log_cli_level = 100 +\ No newline at end of file diff --git a/tests/pytest.ini b/tests/pytest.ini index a87c1f8..eb02918 100644 --- a/tests/pytest.ini +++ b/tests/pytest.ini @@ -1,3 +1,4 @@ [pytest] addopts = --verbose --assert=rewrite --exitfirst --tb=native python_files = t?_*.py +log_cli_level = 100
\ No newline at end of file diff --git a/tests/t1_backends.py b/tests/t1_backends.py index afc92cd..3b5e583 100755 --- a/tests/t1_backends.py +++ b/tests/t1_backends.py @@ -857,7 +857,7 @@ def test_list_bug(backend, monkeypatch): @pytest.mark.with_backend('s3c/aes+zlib', require_mock_server=True) -def test_corrupted_get(backend, monkeypatch, reg_output): +def test_corrupted_get(backend, monkeypatch): key = 'brafasel' value = b'hello there, let us see whats going on' backend[key] = value @@ -873,10 +873,6 @@ def test_corrupted_get(backend, monkeypatch, reg_output): return send_header_real(self, keyword, value) monkeypatch.setattr(handler_class, 'send_header', send_header) - # For some reason the log messages end up on stderr in some - # cases - ignore them. - reg_output(r'WARNING\b.*\bMD5 mismatch for brafasel', count=3) - with assert_logs('^MD5 mismatch for', count=1, level=logging.WARNING): assert_raises(BadDigestError, backend.fetch, key) @@ -886,7 +882,7 @@ def test_corrupted_get(backend, monkeypatch, reg_output): @pytest.mark.with_backend('s3c/{raw,aes+zlib}', require_mock_server=True) -def test_corrupted_meta(backend, monkeypatch, reg_output): +def test_corrupted_meta(backend, monkeypatch): key = 'brafasel' value = b'hello there, let us see whats going on' backend[key] = value @@ -902,10 +898,6 @@ def test_corrupted_meta(backend, monkeypatch, reg_output): return send_header_real(self, keyword, value) monkeypatch.setattr(handler_class, 'send_header', send_header) - # For some reason the log messages end up on stderr in some - # cases - ignore them. - reg_output(r'WARNING\b.*\bMD5 mismatch in metadata for brafasel', count=3) - with assert_logs('^MD5 mismatch in metadata for', count=1, level=logging.WARNING): assert_raises(BadDigestError, backend.fetch, key) @@ -1267,7 +1259,7 @@ def test_expired_token_put(backend, monkeypatch): @pytest.mark.with_backend('s3c/{raw,aes+zlib}', require_mock_server=True) -def test_conn_abort(backend, monkeypatch, reg_output): +def test_conn_abort(backend, monkeypatch): '''Close connection while sending data''' data = b'hello there, let us see whats going on' @@ -1285,11 +1277,6 @@ def test_conn_abort(backend, monkeypatch, reg_output): self.close_connection = True monkeypatch.setattr(handler_class, 'send_data', send_data) - # For some reason the log messages end up on stderr in some - # cases - ignore them. - reg_output(r"WARNING\b.*\bObject closed prematurely, can't check MD5", - count=1) - with pytest.raises(ConnectionClosed): with assert_logs("^Object closed prematurely, can't check MD5", count=1, level=logging.WARNING): |