def test_autouse_and_usefixture_module_scope_runs_before_function_fixtures(testdir):
    testdir.makepyfile('\n        import pytest\n        from pytest_lazyfixture import lazy_fixture\n\n        invocation_order = []\n\n        @pytest.fixture(autouse=True)\n        def autouse_fixture():\n            invocation_order.append(\'using autouse_fixture\')\n\n        @pytest.fixture(scope=\'module\')\n        def module_fixture():\n            invocation_order.append(\'using module fixture\')\n\n        @pytest.fixture\n        def fixture1():\n            invocation_order.append(\'using fixture1\')\n            return \'fixture1\'\n\n        @pytest.fixture\n        def fixture2():\n            invocation_order.append(\'using fixture2\')\n            return \'fixture2\'\n\n        @pytest.mark.usefixtures("module_fixture")\n        @pytest.mark.parametrize("fixt", [lazy_fixture("fixture1"), lazy_fixture("fixture2")])\n        def test_test(fixt):\n            if fixt == \'fixture2\':\n                print(\' \'.join(invocation_order))\n    ')
    result = testdir.runpytest('-s')
    stdout = result.stdout.str()
    assert (('using autouse_fixture using module fixture using fixture1 using autouse_fixture using fixture2' in stdout) or ('using module fixture using autouse_fixture using fixture1 using autouse_fixture using fixture2' in stdout))
def test_autouse_and_usefixture_module_scope_runs_before_function_fixtures(testdir):
    testdir.makepyfile('\n        import pytest\n        from pytest_lazyfixture import lazy_fixture\n\n        invocation_order = []\n\n        @pytest.fixture(autouse=True)\n        def autouse_fixture():\n            invocation_order.append(\'using autouse_fixture\')\n\n        @pytest.fixture(scope=\'module\')\n        def module_fixture():\n            invocation_order.append(\'using module fixture\')\n\n        @pytest.fixture\n        def fixture1():\n            invocation_order.append(\'using fixture1\')\n            return \'fixture1\'\n\n        @pytest.fixture\n        def fixture2():\n            invocation_order.append(\'using fixture2\')\n            return \'fixture2\'\n\n        @pytest.mark.usefixtures("module_fixture")\n        @pytest.mark.parametrize("fixt", [lazy_fixture("fixture1"), lazy_fixture("fixture2")])\n        def test_test(fixt):\n            if fixt == \'fixture2\':\n                print(\' \'.join(invocation_order))\n    ')
    result = testdir.runpytest('-s')
    stdout = result.stdout.str()
    assert (('using autouse_fixture using module fixture using fixture1 using autouse_fixture using fixture2' in stdout) or ('using module fixture using autouse_fixture using fixture1 using autouse_fixture using fixture2' in stdout))