Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better way to fix DAG import test #220

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

tskir
Copy link
Contributor

@tskir tskir commented Nov 2, 2023

Closes opentargets/issues#3140 (again -__-)

After the fix in #218 it turned out that pytest's DagBag import and the actual Airflow deployment still differ in how they treat imports. In particular, "from . import airflow_common" imports work in pytest, but not in the actual Airflow set up.

After digging further, it looks like the proper way to make pytest evaluate those files is to extend its PYTHONPATH (not PATH and not the current working directory).

My apologies for the mix-up, the new configuration should now fix things for good.

@tskir tskir requested review from d0choa and ireneisdoomed November 2, 2023 17:04
Copy link
Contributor

@ireneisdoomed ireneisdoomed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way more elegant solution, thanks!

@ireneisdoomed ireneisdoomed merged commit 2014e48 into main Nov 3, 2023
1 check passed
@ireneisdoomed ireneisdoomed deleted the tskir-3140-better-dag-import-fix branch November 3, 2023 09:15
@ireneisdoomed ireneisdoomed restored the tskir-3140-better-dag-import-fix branch November 3, 2023 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-enable and fix the test_no_import_errors Airflow DAG test
2 participants