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

changedir not working #144

Open
zkurtz opened this issue Dec 21, 2024 · 3 comments
Open

changedir not working #144

zkurtz opened this issue Dec 21, 2024 · 3 comments

Comments

@zkurtz
Copy link

zkurtz commented Dec 21, 2024

Issue

I'm using tox specifically so that I can catch errors that pytest would otherwise miss. For example, if I add a package resource to my files and include a unit test that loads that resource, pytest will think everything is fine. Noticing that my package doesn't load because I failed to include the new resource in package data happens only later, when I try to install the package in a new environment using the whl.

I've found that running tox with this configuration works as desired, raising an error where I try to load a package resource that was not added to package data:

[tox]
isolated_build=True

[testenv]
description = Run unit tests
deps =
    pytest
dependency_groups = extras
changedir = {envtmpdir}  # suggested by https://blog.ganssle.io/articles/2019/08/test-as-installed.html
commands = python -m pytest {posargs} {toxinidir}

However, deleting

deps =
    pytest

and replacing it with

runner = uv-venv-lock-runner
with_dev = true

puts me back where I started; tox runs without noticing the problem. Please let me know if it's obvious what's going on here -- if not I may follow up with a reproducable example.

Environment

  • OS: OSX 15.1.1
@zkurtz zkurtz added the bug Something isn't working label Dec 21, 2024
@ssbarnea
Copy link
Member

@zkurtz Feel free to make PR to fix it. Basically every option supported by Tox own venv implementation will need to be implemented by this as they do not magically work.

@zkurtz
Copy link
Author

zkurtz commented Jan 1, 2025

I'm interested to work on this if someone can provide some suggestions on how to get started. I'll poke around a bit.

@gaborbernat
Copy link
Member

puts me back where I started; tox runs without noticing the problem. Please let me know if it's obvious what's going on here -- if not I may follow up with a reproducable example.

When this happens tox just delegates the job to uv. So perhaps the issue is with uv, not tox? Did you ask aroun in the uv to find out how it works?

@gaborbernat gaborbernat added needs-triage and removed bug Something isn't working labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants