File: test_01_marker.py

package info (click to toggle)
pytest-dependency 0.5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 464 kB
  • sloc: python: 1,542; makefile: 66; sh: 8
file content (27 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (2)
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
"""The most basic test: check that the marker works.
"""

import pytest


def test_marker_registered(ctestdir):
    result = ctestdir.runpytest("--markers")
    result.stdout.fnmatch_lines("""
        @pytest.mark.dependency*
    """)


def test_marker(ctestdir):
    ctestdir.makepyfile("""
        import pytest
        from pytest_dependency import DependencyManager

        @pytest.mark.dependency()
        def test_marker(request):
            node = request.node.getparent(pytest.Module)
            assert hasattr(node, 'dependencyManager')
            assert isinstance(node.dependencyManager, DependencyManager)
            assert 'test_marker' in node.dependencyManager.results
    """)
    result = ctestdir.runpytest("--verbose")
    result.assert_outcomes(passed=1)