parent
f552f433f8
commit
65891c6f0d
@ -27,6 +27,7 @@ import collections
|
||||
import itertools
|
||||
import logging
|
||||
import textwrap
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
||||
@ -309,3 +310,10 @@ def py_proc():
|
||||
def func(code):
|
||||
return (sys.executable, ['-c', textwrap.dedent(code.strip('\n'))])
|
||||
return func
|
||||
|
||||
|
||||
@pytest.yield_fixture(autouse=True)
|
||||
def fail_tests_on_warnings():
|
||||
warnings.simplefilter('error')
|
||||
yield
|
||||
warnings.resetwarnings()
|
||||
|
@ -20,6 +20,11 @@
|
||||
"""Various meta-tests for conftest.py."""
|
||||
|
||||
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_qapp_name(qapp):
|
||||
"""Make sure the QApplication name is changed when we use qapp."""
|
||||
assert qapp.applicationName() == 'qute_test'
|
||||
@ -28,3 +33,8 @@ def test_qapp_name(qapp):
|
||||
def test_no_qapp(request):
|
||||
"""Make sure a test without qapp doesn't use qapp (via autouse)."""
|
||||
assert 'qapp' not in request.fixturenames
|
||||
|
||||
|
||||
def test_fail_on_warnings():
|
||||
with pytest.raises(PendingDeprecationWarning):
|
||||
warnings.warn('test', PendingDeprecationWarning)
|
||||
|
Loading…
Reference in New Issue
Block a user