2024-01-26 14:02:52 -08:00
|
|
|
import pathlib
|
|
|
|
import site
|
|
|
|
|
2025-02-13 08:28:48 -08:00
|
|
|
from datahub.testing.pytest_hooks import ( # noqa: F401
|
2025-02-12 15:32:31 -08:00
|
|
|
load_golden_flags,
|
|
|
|
pytest_addoption,
|
|
|
|
)
|
2024-01-26 14:02:52 -08:00
|
|
|
|
2025-02-12 15:32:31 -08:00
|
|
|
# The integration tests run Airflow, with our plugin, in a subprocess.
|
|
|
|
# To get more accurate coverage, we need to ensure that the coverage
|
|
|
|
# library is available in the subprocess.
|
2024-01-26 14:02:52 -08:00
|
|
|
# See https://coverage.readthedocs.io/en/latest/subprocess.html#configuring-python-for-sub-process-measurement
|
|
|
|
coverage_startup_code = "import coverage; coverage.process_startup()"
|
|
|
|
site_packages_dir = pathlib.Path(site.getsitepackages()[0])
|
|
|
|
pth_file_path = site_packages_dir / "datahub_coverage_startup.pth"
|
|
|
|
pth_file_path.write_text(coverage_startup_code)
|