Skip to content

Meson editable install: pytest --pyargs does not collect any tests  #568

@lesteve

Description

@lesteve

To reproduce

mkdir -p ~/venvs
rm -rf ~/venvs/test-env
python -m venv ~/venvs/test-env
pip install scipy joblib threadpoolctl cython meson-python ninja pytest
git clone https://github.com/scikit-learn/scikit-learn --depth 1
cd scikit-learn
make dev-meson
# go outside of repo root (with pytest 8 it fails also in the repo root)
cd
pytest --pyargs sklearn --collect-only

Output shows "no tests collected in 0.10s". Without --pyargs, this works fine, pytest sklearn --collect-only shows ~33k tests.

I checked that numpy has the same issue, so this is not specific to scikit-learn

Could this be related to #557? I have to check I haven't taken the time to confirm it yet. Actually I checked with @ogrisel branch from #562 and it seems to collect tests fine, so this seems related.

Full disclosure: with pytest<8, tests are collected if you stay in the repo root. I believe this is kind of by chance, since pytest 8 has introduced collection behaviour changes/fixes see https://docs.pytest.org/en/stable/changelog.html#collection-changes for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions