Skip to content

changedir not working #144

@zkurtz

Description

@zkurtz

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions