"""Root conftest: ensure Django is configured before any test conftest imports models. pytest-django normally handles this, but our tests-dir conftest imports plugin modules at collection time, so we force ``django.setup()`` here unconditionally and early. """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "netbox.settings") import django # noqa: E402 if not django.apps.apps.ready: django.setup()