airflow icon indicating copy to clipboard operation
airflow copied to clipboard

[Experiment] Use `importlib` import mode for `pytest`

Open Taragolis opened this issue 1 year ago • 5 comments
trafficstars

Just an experiment whether or not airflow tests could use importlib mode instead of prepend


^ Add meaningful description above Read the Pull Request Guidelines for more information. In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed. In case of a new dependency, check compliance with the ASF 3rd Party License Policy. In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

Taragolis avatar Mar 28 '24 20:03 Taragolis

interesting . I had no idea pytest is doing that.

potiuk avatar Mar 28 '24 22:03 potiuk

interesting . I had no idea pytest is doing that.

I've found myself it about week ago when try to find how to solve one issue.

Taragolis avatar Mar 28 '24 22:03 Taragolis

🤔 🤔 🤔

        # Provide existent file path,
        # so loaded YAML file content should be used to call deserialize_model_dict(), rather than None.
        path = sys.path[0] + "/tests/providers/cncf/kubernetes/pod.yaml"
>       with open(path) as stream:
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/tests/providers/cncf/kubernetes/pod.yaml'

Taragolis avatar Mar 28 '24 23:03 Taragolis

path = sys.path[0] + "/tests/providers/cncf/kubernetes/pod.yaml"

Yeah. Someone took advantage of assuming sys.path will be modified :)

potiuk avatar Mar 28 '24 23:03 potiuk

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 20 '24 00:05 github-actions[bot]