summaryrefslogtreecommitdiffstats
path: root/library/python/pytest/ut/conftest_non_local/tests/test_non_local.py
blob: 0635a57eef29fa799519aecfb11bf2845b73907c (plain) (blame)
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
def test_conftest_plugin_order(pytestconfig):
    # Unintuitively, pluggy invokes hooks in reverse-registration order.
    # This includes `pytest_confugure` for plugins registered before pytest session starts.
    # See comments on HookCaller._hookimpls in contrib/python/pluggy/py3/pluggy/_hooks.py
    assert pytestconfig._my_conftests == [
        'conftest_non_local/tests/lib_child/conftest.py',
        'conftest_non_local/tests/conftest.py',
        'conftest_non_local/lib2/conftest.py',
        'conftest_non_local/lib/conftest.py',
        'conftest_non_local/conftest.py',
    ]


def test_conftests_are_initial(request):
    assert set(request.session._my_conftests) == {
        'conftest_non_local/conftest.py',
        'conftest_non_local/lib/conftest.py',
        'conftest_non_local/lib2/conftest.py',
        'conftest_non_local/tests/conftest.py',
        'conftest_non_local/tests/lib_child/conftest.py',
    }


def test_conftest_fixture_order(fixture_order):
    assert fixture_order == [
        'conftest_non_local/conftest.py',
        'conftest_non_local/lib/conftest.py',
        'conftest_non_local/lib2/conftest.py',
        'conftest_non_local/tests/conftest.py',
        'conftest_non_local/tests/lib_child/conftest.py',
    ]