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

Support venv detection on Windows with mingw Python #12545

Merged
merged 5 commits into from
Jun 28, 2024

Conversation

zachsnicker
Copy link
Contributor

@zachsnicker zachsnicker commented Jun 28, 2024

closes #12544

  • Updated the _in_venv function in src/_pytest/main.py to correctly detect Python virtual environments.
  • Updated the test cases in testing/test_collection.py to validate the new behavior.
  • Created a changelog fragment to document this improvement.

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jun 28, 2024
Copy link

@lazka lazka left a comment

Choose a reason for hiding this comment

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

These docs need to be updated too: https://github.com/pytest-dev/pytest/blob/main/doc/en/reference/reference.rst?plain=1#L1705-L1706

I'd guess just removing the " by the presence of an activation script" should be enough. The users shouldn't need to care how it's done.

Otherwise lgtm, code wise.

src/_pytest/main.py Outdated Show resolved Hide resolved
src/_pytest/main.py Outdated Show resolved Hide resolved
Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

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

Thanks @zachsnicker, and @lazka for the review.

@bluetech bluetech merged commit 0adcc21 into pytest-dev:main Jun 28, 2024
28 of 29 checks passed
@zachsnicker zachsnicker deleted the venv-detection-mingw branch June 29, 2024 05:26
webknjaz added a commit to webknjaz/pytest that referenced this pull request Jul 2, 2024
webknjaz added a commit to webknjaz/pytest that referenced this pull request Jul 2, 2024
Copy link
Member

Choose a reason for hiding this comment

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

@jezdez
Copy link

jezdez commented Jul 23, 2024

Seems like this is basically breaking pytest support in conda environments, can we revert this change until we've reliably roll out pyvenv.cfg in conda envs (see recent conversations in conda/conda#13337)?

@RonnyPfannschmidt
Copy link
Member

@jezdez is there a good way to check for conda prior to that change? im happy to roll back for now, but if a consistent bugfix that ensures compatibility with older conda is easy, i'd prefer landing that over a revert dance

@jezdez
Copy link

jezdez commented Jul 23, 2024

@jezdez is there a good way to check for conda prior to that change? im happy to roll back for now, but if a consistent bugfix that ensures compatibility with older conda is easy, i'd prefer landing that over a revert dance

Actually, apologies for responding to a closed PR, can we move that into #12652 please?

Glyphack pushed a commit to Glyphack/pytest that referenced this pull request Jul 30, 2024
Glyphack pushed a commit to Glyphack/pytest that referenced this pull request Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support venv detection on Windows with mingw Python
6 participants