File: test_pytest.py

package info (click to toggle)
celery 5.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,008 kB
  • sloc: python: 64,346; sh: 795; makefile: 378
file content (31 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pytest

pytest_plugins = ["pytester"]

try:
    pytest.fail()
except BaseException as e:
    Failed = type(e)


@pytest.mark.skipif(
    not hasattr(pytest, "PytestUnknownMarkWarning"),
    reason="Older pytest version without marker warnings",
)
def test_pytest_celery_marker_registration(testdir):
    """Verify that using the 'celery' marker does not result in a warning"""
    testdir.plugins.append("celery")
    testdir.makepyfile(
        """
        import pytest
        @pytest.mark.celery(foo="bar")
        def test_noop():
            pass
        """
    )

    result = testdir.runpytest('-q')
    with pytest.raises((ValueError, Failed)):
        result.stdout.fnmatch_lines_random(
            "*PytestUnknownMarkWarning: Unknown pytest.mark.celery*"
        )