astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
12.16k stars 427 forks source link

Rye test is not scoped to workspace members #853

Open thoward27 opened 3 months ago

thoward27 commented 3 months ago

Steps to Reproduce

  1. Create a new virtual rye project with one or more members.
  2. Define additional python packages outside of the members directory.
  3. Run rye test --all

At this point, rye is trying to run every test it can find, not just tests in my workspace members.

Example layout for a large monorepo

Structure:

project/
  crates/ # Rust crates published to Crates.IO
  pypi/ # Python wheels published to pypi
  tools/ # Random tools that I don't care about

Root toml:

[project]
name = "project"
version = "0.1.0"
description = "Add your description here"
authors = [
    { name = "Bob", email = "Bob@bob.bob" }
]
dependencies = []
readme = "README.md"
requires-python = ">= 3.9"

[tool.rye]
managed = true
virtual = true
dev-dependencies = [
    "pytest>=8.0.2",
]

[tool.rye.workspace]
members = ["pypi/*"]

Expected Result

I expect that rye will only run the tests for project members in pypi/.

Actual Result

Rye is running every test file in the entire repo, including the tools directory.

Version Info

rye 0.28.0 commit: 0.28.0 (c44dc7ec8 2024-03-07) platform: macos (aarch64) self-python: cpython@3.12.2 symlink support: true uv enabled: false

Stacktrace

No response

hyyking commented 3 months ago

image

Can reproduce, weirdly enough rye test --all and rye test don't have the same behaviour

Version:

rye 0.28.0 commit: 0.26.0+54 (73cd886f1 2024-03-05) platform: windows (x86_64) self-python: cpython@3.12 symlink support: true uv enabled: true

hyyking commented 3 months ago

After self update this is 100% reproducible.

image

Version:

rye 0.29.0 commit: 0.28.0+6 (9484b1a81 2024-03-08) platform: windows (x86_64) self-python: cpython@3.12.2 symlink support: true uv enabled: true