File tree 3 files changed +38
-2
lines changed 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change
1
+ # 1.7.1.dev #
2
+
3
+ - Fixed internal error when interacting with other plugins that raise an error,
4
+ hiding the original exception (#98 ). Thanks @The-Compiler for the PR!
5
+
6
+ - Now ` pytest-qt ` is properly tested with PyQt5 on Travis-CI. Many thanks
7
+ to @The-Compiler for the PR!
8
+
1
9
# 1.7.0 #
2
10
3
11
- ` PYTEST_QT_API ` can now be set to ` pyqt4v2 ` in order to use version 2 of the
Original file line number Diff line number Diff line change @@ -40,13 +40,12 @@ def pytest_runtest_setup(self, item):
40
40
@pytest .mark .hookwrapper
41
41
def pytest_runtest_makereport (self , item , call ):
42
42
"""Add captured Qt messages to test item report if the call failed."""
43
-
44
43
outcome = yield
45
44
if not hasattr (item , 'qt_log_capture' ):
46
45
return
47
46
48
47
if call .when == 'call' :
49
- report = outcome .result
48
+ report = outcome .get_result ()
50
49
51
50
m = item .get_marker ('qt_log_level_fail' )
52
51
if m :
Original file line number Diff line number Diff line change @@ -484,3 +484,32 @@ def test_foo(request):
484
484
'*None:None:None:*' ,
485
485
'* QtWarningMsg: WARNING message*' ,
486
486
])
487
+
488
+
489
+ def test_logging_broken_makereport (testdir ):
490
+ """
491
+ Make sure logging's makereport hookwrapper doesn't hide exceptions.
492
+
493
+ See https://github.com/pytest-dev/pytest-qt/issues/98
494
+
495
+ :type testdir: _pytest.pytester.TmpTestdir
496
+ """
497
+ testdir .makepyfile (conftest = """
498
+ import pytest
499
+
500
+ @pytest.mark.hookwrapper(tryfirst=True)
501
+ def pytest_runtest_makereport(call):
502
+ if call.when == 'call':
503
+ raise Exception("This should not be hidden")
504
+ yield
505
+ """ )
506
+ p = testdir .makepyfile (
507
+ """
508
+ def test_foo():
509
+ pass
510
+ """
511
+ )
512
+ res = testdir .runpytest_subprocess (p )
513
+ res .stdout .fnmatch_lines ([
514
+ '*This should not be hidden*' ,
515
+ ])
You can’t perform that action at this time.
0 commit comments