Skip to content

CI good practice #13138

Closed Answered by webknjaz
ego-thales asked this question in Q&A
Jan 16, 2025 · 4 comments · 3 replies
Discussion options

You must be logged in to vote

@ego-thales that depends on a few factors:

  • when you run python -m pytest, Python itself adds the current working directory to PYTHONPATH, while running pytest does not do that (which is what you do, it seems — with uv run pytest and not uv run python -m pytest; it's not uv magic).

    I like running python -Im pytest to counteract that import path influence, while still being in control of what Python interpreter is being used.

  • depending on whether you have an __init__.py in your tests directory, I think pytest auto-injects things into sys.path too

With that in mind, if you know what you're doing, you can trick it into one behavior or the other, and do it however you like, really.

OTOH,…

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@graingert
Comment options

@ego-thales
Comment options

@webknjaz
Comment options

Answer selected by ego-thales
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants