Debian Codegraph @

t/unit/contrib/test_pytest.py

raw
1 import pytest
2
3 pytest_plugins = ["pytester"]
4
5 try:
6 pytest.fail()
7 except BaseException as e:
8 Failed = type(e)
9
10
11 @pytest.mark.skipif(
12 not hasattr(pytest, "PytestUnknownMarkWarning"),
13 reason="Older pytest version without marker warnings",
14 )
15 def test_pytest_celery_marker_registration(testdir):
16 """Verify that using the 'celery' marker does not result in a warning"""
17 testdir.plugins.append("celery")
18 testdir.makepyfile(
19 """
20 import pytest
21 @pytest.mark.celery(foo="bar")
22 def test_noop():
23 pass
24 """
25 )
26
27 result = testdir.runpytest('-q')
28 with pytest.raises((ValueError, Failed)):
29 result.stdout.fnmatch_lines_random(
30 "*PytestUnknownMarkWarning: Unknown pytest.mark.celery*"
31 )