MCPcopy
hub / github.com/networkx/networkx / pytest_configure

Function pytest_configure

networkx/conftest.py:43–75  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

41
42
43def pytest_configure(config):
44 config.addinivalue_line("markers", "slow: mark test as slow to run")
45 backend = config.getoption("--backend")
46 if backend is None:
47 backend = os.environ.get("NETWORKX_TEST_BACKEND")
48 # nx_loopback backend is only available when testing with a backend
49 loopback_ep = entry_points(name="nx_loopback", group="networkx.backends")
50 if not loopback_ep:
51 warnings.warn(
52 "\n\n WARNING: Mixed NetworkX configuration! \n\n"
53 " This environment has mixed configuration for networkx.\n"
54 " The test object nx_loopback is not configured correctly.\n"
55 " You should not be seeing this message.\n"
56 " Try `pip install -e .`, or change your PYTHONPATH\n"
57 " Make sure python finds the networkx repo you are testing\n\n"
58 )
59 config.backend = backend
60 if backend:
61 # We will update `networkx.config.backend_priority` below in `*_modify_items`
62 # to allow tests to get set up with normal networkx graphs.
63 nx.utils.backends.backends["nx_loopback"] = loopback_ep["nx_loopback"]
64 nx.utils.backends.backend_info["nx_loopback"] = {}
65 nx.config.backends = nx.utils.Config(
66 nx_loopback=nx.utils.Config(),
67 **nx.config.backends,
68 )
69 fallback_to_nx = config.getoption("--fallback-to-nx")
70 if not fallback_to_nx:
71 fallback_to_nx = os.environ.get("NETWORKX_FALLBACK_TO_NX")
72 nx.config.fallback_to_nx = bool(fallback_to_nx)
73 nx.utils.backends._dispatchable.__call__ = (
74 nx.utils.backends._dispatchable._call_if_any_backends_installed
75 )
76
77
78def pytest_collection_modifyitems(config, items):

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…