I'm using uv
workspace with a structure that looks like the following example from the doc.
albatross
├── packages
│ ├── bird-feeder
│ │ ├── pyproject.toml
│ │ └── src
│ │ └── bird_feeder
│ │ ├── __init__.py
│ │ └── foo.py
│ └── seeds
│ ├── pyproject.toml
│ └── src
│ └── seeds
│ ├── __init__.py
│ └── bar.py
├── pyproject.toml
├── README.md
├── uv.lock
└── src
└── albatross
└── main.py
How do I tell pytest
to use the configuration in each package pyproject.toml
while running pytest
from the root package(albatross in this case) directory?
You can tell pytest
the directory:
uv run pytest packages/bird-feeder
uv run
--package bird-feeder
doesn't work:
uv run --package bird-feeder pytest
doesn't pass pyproject.toml
info to pytest
.pytest
merely infers dir=pathlib.Path.cwd()
.uv run
--directory packages/bird-feeder
works:
uv run --directory packages/bird-feeder pytest
Related: Using uv run
as a task runner #5903 may be supported in future.