summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/end2end/fixtures/testprocess.py2
-rw-r--r--tests/test_conftest.py2
-rw-r--r--tests/unit/config/test_configtypes.py2
-rw-r--r--tests/unit/utils/test_log.py14
4 files changed, 10 insertions, 10 deletions
diff --git a/tests/end2end/fixtures/testprocess.py b/tests/end2end/fixtures/testprocess.py
index 9276a4820..96e700390 100644
--- a/tests/end2end/fixtures/testprocess.py
+++ b/tests/end2end/fixtures/testprocess.py
@@ -319,7 +319,7 @@ class Process(QObject):
if not ok:
cmdline = ' '.join([self.proc.program()] + self.proc.arguments())
warnings.warn(f"Test process {cmdline} with PID {self.proc.processId()} "
- "failed to terminate!", stacklevel=2)
+ "failed to terminate!")
self.proc.kill()
self.proc.waitForFinished()
diff --git a/tests/test_conftest.py b/tests/test_conftest.py
index 2019bfd0b..fedc6b43f 100644
--- a/tests/test_conftest.py
+++ b/tests/test_conftest.py
@@ -41,7 +41,7 @@ def test_no_qapp(request):
def test_fail_on_warnings():
with pytest.raises(PendingDeprecationWarning):
- warnings.warn('test', PendingDeprecationWarning, stacklevel=2)
+ warnings.warn('test', PendingDeprecationWarning)
@pytest.mark.xfail(reason="https://github.com/qutebrowser/qutebrowser/issues/1070",
diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py
index 22ac3e9df..99b8a5de0 100644
--- a/tests/unit/config/test_configtypes.py
+++ b/tests/unit/config/test_configtypes.py
@@ -1521,7 +1521,7 @@ class TestRegex:
"""
regex = klass()
m = mocker.patch('qutebrowser.config.configtypes.re')
- m.compile.side_effect = lambda *args: warnings.warn(warning, stacklevel=2)
+ m.compile.side_effect = lambda *args: warnings.warn(warning)
m.error = re.error
with pytest.raises(type(warning)):
regex.to_py('foo')
diff --git a/tests/unit/utils/test_log.py b/tests/unit/utils/test_log.py
index 0a03ea7ee..bbc6b02db 100644
--- a/tests/unit/utils/test_log.py
+++ b/tests/unit/utils/test_log.py
@@ -275,7 +275,7 @@ class TestInitLog:
log.init_log(args)
with caplog.at_level(logging.WARNING):
- warnings.warn("test warning", PendingDeprecationWarning, stacklevel=2)
+ warnings.warn("test warning", PendingDeprecationWarning)
expected = "PendingDeprecationWarning: test warning"
assert expected in caplog.records[0].message
@@ -285,7 +285,7 @@ class TestInitLog:
log.init_log(args)
with pytest.raises(PendingDeprecationWarning):
- warnings.warn("test warning", PendingDeprecationWarning, stacklevel=2)
+ warnings.warn("test warning", PendingDeprecationWarning)
@pytest.mark.parametrize('cli, conf, expected', [
(None, 'info', logging.INFO),
@@ -386,9 +386,9 @@ def test_stub(caplog, suffix, expected):
def test_py_warning_filter(caplog):
logging.captureWarnings(True)
with log.py_warning_filter(category=UserWarning):
- warnings.warn("hidden", UserWarning, stacklevel=2)
+ warnings.warn("hidden", UserWarning)
with caplog.at_level(logging.WARNING):
- warnings.warn("not hidden", UserWarning, stacklevel=2)
+ warnings.warn("not hidden", UserWarning)
assert len(caplog.records) == 1
msg = caplog.messages[0].splitlines()[0]
assert msg.endswith("UserWarning: not hidden")
@@ -396,17 +396,17 @@ def test_py_warning_filter(caplog):
def test_py_warning_filter_error(caplog):
warnings.simplefilter('ignore')
- warnings.warn("hidden", UserWarning, stacklevel=2)
+ warnings.warn("hidden", UserWarning)
with log.py_warning_filter('error'):
with pytest.raises(UserWarning):
- warnings.warn("error", UserWarning, stacklevel=2)
+ warnings.warn("error", UserWarning)
def test_warning_still_errors():
# Mainly a sanity check after the tests messing with warnings above.
with pytest.raises(UserWarning):
- warnings.warn("error", UserWarning, stacklevel=2)
+ warnings.warn("error", UserWarning)
class TestQtMessageHandler: