import pytest

from fuzz_lightyear.datastore import _ALL_POST_FUZZ_HOOKS_BY_OPERATION
from fuzz_lightyear.datastore import _ALL_POST_FUZZ_HOOKS_BY_TAG
from fuzz_lightyear.datastore import _RERUN_POST_FUZZ_HOOKS_BY_OPERATION
from fuzz_lightyear.datastore import _RERUN_POST_FUZZ_HOOKS_BY_TAG
from fuzz_lightyear.datastore import get_excluded_operations
from fuzz_lightyear.datastore import get_included_tags
from fuzz_lightyear.datastore import get_non_vulnerable_operations
from fuzz_lightyear.datastore import get_user_defined_mapping
from fuzz_lightyear.plugins import get_enabled_plugins
from fuzz_lightyear.request import get_victim_session_factory
from fuzz_lightyear.supplements.abstraction import get_abstraction


@pytest.fixture(autouse=True)
def clear_caches():
    get_abstraction.cache_clear()
    get_user_defined_mapping.cache_clear()
    get_enabled_plugins.cache_clear()
    get_victim_session_factory.cache_clear()
    get_excluded_operations.cache_clear()
    get_non_vulnerable_operations.cache_clear()
    get_included_tags.cache_clear()

    _ALL_POST_FUZZ_HOOKS_BY_OPERATION.clear()
    _ALL_POST_FUZZ_HOOKS_BY_TAG.clear()
    _RERUN_POST_FUZZ_HOOKS_BY_OPERATION.clear()
    _RERUN_POST_FUZZ_HOOKS_BY_TAG.clear()


@pytest.fixture(autouse=True)
def ignore_hypothesis_non_interactive_example_warning():
    """In theory we're not supposed to use hypothesis'
    strategy.example(), but fuzz-lightyear isn't using
    hypothesis in a normal way.
    """
    import warnings
    from hypothesis.errors import NonInteractiveExampleWarning
    warnings.filterwarnings(
        'ignore',
        category=NonInteractiveExampleWarning,
    )

[((723, 751), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (737, 751), False, 'import pytest\n'), ((1238, 1266), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1252, 1266), False, 'import pytest\n'), ((776, 805), 'fuzz_lightyear.supplements.abstraction.get_abstraction.cache_clear', 'get_abstraction.cache_clear', ([], {}), '()\n', (803, 805), False, 'from fuzz_lightyear.supplements.abstraction import get_abstraction\n'), ((810, 848), 'fuzz_lightyear.datastore.get_user_defined_mapping.cache_clear', 'get_user_defined_mapping.cache_clear', ([], {}), '()\n', (846, 848), False, 'from fuzz_lightyear.datastore import get_user_defined_mapping\n'), ((853, 886), 'fuzz_lightyear.plugins.get_enabled_plugins.cache_clear', 'get_enabled_plugins.cache_clear', ([], {}), '()\n', (884, 886), False, 'from fuzz_lightyear.plugins import get_enabled_plugins\n'), ((891, 931), 'fuzz_lightyear.request.get_victim_session_factory.cache_clear', 'get_victim_session_factory.cache_clear', ([], {}), '()\n', (929, 931), False, 'from fuzz_lightyear.request import get_victim_session_factory\n'), ((936, 973), 'fuzz_lightyear.datastore.get_excluded_operations.cache_clear', 'get_excluded_operations.cache_clear', ([], {}), '()\n', (971, 973), False, 'from fuzz_lightyear.datastore import get_excluded_operations\n'), ((978, 1021), 'fuzz_lightyear.datastore.get_non_vulnerable_operations.cache_clear', 'get_non_vulnerable_operations.cache_clear', ([], {}), '()\n', (1019, 1021), False, 'from fuzz_lightyear.datastore import get_non_vulnerable_operations\n'), ((1026, 1057), 'fuzz_lightyear.datastore.get_included_tags.cache_clear', 'get_included_tags.cache_clear', ([], {}), '()\n', (1055, 1057), False, 'from fuzz_lightyear.datastore import get_included_tags\n'), ((1063, 1104), 'fuzz_lightyear.datastore._ALL_POST_FUZZ_HOOKS_BY_OPERATION.clear', '_ALL_POST_FUZZ_HOOKS_BY_OPERATION.clear', ([], {}), '()\n', (1102, 1104), False, 'from fuzz_lightyear.datastore import _ALL_POST_FUZZ_HOOKS_BY_OPERATION\n'), ((1109, 1144), 'fuzz_lightyear.datastore._ALL_POST_FUZZ_HOOKS_BY_TAG.clear', '_ALL_POST_FUZZ_HOOKS_BY_TAG.clear', ([], {}), '()\n', (1142, 1144), False, 'from fuzz_lightyear.datastore import _ALL_POST_FUZZ_HOOKS_BY_TAG\n'), ((1149, 1192), 'fuzz_lightyear.datastore._RERUN_POST_FUZZ_HOOKS_BY_OPERATION.clear', '_RERUN_POST_FUZZ_HOOKS_BY_OPERATION.clear', ([], {}), '()\n', (1190, 1192), False, 'from fuzz_lightyear.datastore import _RERUN_POST_FUZZ_HOOKS_BY_OPERATION\n'), ((1197, 1234), 'fuzz_lightyear.datastore._RERUN_POST_FUZZ_HOOKS_BY_TAG.clear', '_RERUN_POST_FUZZ_HOOKS_BY_TAG.clear', ([], {}), '()\n', (1232, 1234), False, 'from fuzz_lightyear.datastore import _RERUN_POST_FUZZ_HOOKS_BY_TAG\n'), ((1561, 1633), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'NonInteractiveExampleWarning'}), "('ignore', category=NonInteractiveExampleWarning)\n", (1584, 1633), False, 'import warnings\n')]