File indexing completed on 2026-04-25 08:29:08
0001 """
0002 This conftest.py ensures that if pytest is run directly on a test file (not via the test script or project root),
0003 it will gently fail with a clear message instructing the user to use the correct test runner for robustness.
0004
0005 Test files should be located in tests/ directory and discovered automatically by the test runner.
0006 """
0007 import os
0008 import pytest
0009
0010 def pytest_configure(config):
0011
0012
0013 if os.path.basename(os.getcwd()) != "swf-common-lib":
0014 pytest.exit(
0015 "\n[SWF-COMMON-LIB TEST SUITE]\n\n"
0016 "You are running pytest in a way that does not use the robust test runner.\n"
0017 "For robust and reliable results, always run tests using:\n"
0018 " ./run_tests.sh (from swf-common-lib repo root directory)\n"
0019 "or\n"
0020 " ./run_all_tests.sh (from the umbrella/testbed repo root)\n\n"
0021 "Test files should be in tests/ directory and will be discovered automatically.\n"
0022 "Direct invocation of pytest on a test file or from the wrong directory is not supported.\n",
0023 returncode=4
0024 )