Modify e2e test's directory change logic
Running our PEXes as zipapps rather than venvs means that we need to
change the logic we use to find our e2e tests.
@@ -15,21 +15,10 @@ def main() -> None:
from grapl_tests_common import setup_tests # import here to limit monkeypatch
- _cd_to_test_directory()
+ # Change to the parent directory so pytest can find the tests
+ os.chdir(Path(__file__).resolve().parent)
result = setup_tests.exec_pytest()
LOGGER.info(f"tests completed with status code {result}")
sys.exit(result)
-
-
-def _cd_to_test_directory() -> None:
- """
- One intricacy of running Pytest in a PEX is that the PEX format messes with
- pytest and xunit's test discovery (since that often depends on file structure).
- As such, we just `chdir` into the site-packages folder for `e2e_test_runner`.
- While there are potentially more robust ways to do this, this one works.
- """
- this_file = Path(__file__).resolve()
- site_packages = next(p for p in this_file.parents if p.name == "site-packages")
- os.chdir(site_packages / "e2e_test_runner")
