[Bug] Rust test-harness crates named `tests-build` and `tests-integration` are classed as production code

Open
#6,301 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@rishu685 is already working on this.

Since Nov 26, 2026.

  • #6329 by @rishu685 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python, rust
Domain
backend, testing

Research direction

Start by running the repro one-liner against path_origin in repowise.core.code_origin, around line 1219, and read how it consults test_paths.py, including the _SUPPORT_DIR_WORDS_UNLESS_PACKAGE set near lines 220-222 and the package_root probe near lines 211-216. The chosen rule (a tests-* workspace member root or a publish = false Cargo manifest signal) must be decided first, since the issue asks for a judgement call. Done when tests-build/src/lib.rs and tests-integration/src/lib.rs classify as test, a published tests-* crate stays production, and both tests/unit/test_test_paths.py and tests/unit/test_code_origin.py pass.

Written by the indexing model from the issue text.

Description

bug help wanted

Summary

A Rust workspace member that exists only to test the library, such as a crate in tests-build/ or tests-integration/ with publish = false, is classed as production code. Its src/ files count as shipped code everywhere origin is read.

packages/core/src/repowise/core/test_paths.py:220-222

_SUPPORT_DIR_WORDS_UNLESS_PACKAGE: frozenset[str] = frozenset(
    {"testhelpers", "testhelper", "testutils", "testutil", "testsupport"}
)

Mechanism

  • path_origin (code_origin.py:1219) reads test paths from test_paths.py, which matches a tests/ tree (:82) and support directories such as test-util/, not a sibling crate named tests-build.
  • Files under tests-integration/tests/ are already test; only the crate's src/ reads as production.
  • Adding testsbuild to the set above would not help: a support directory that is a package root stays production (:211-216), and every Rust crate has a Cargo.toml. The exact signal is the manifest (publish = false on a crate named for tests), which path_origin does not read today.

Repro

python -c "from repowise.core.code_origin import path_origin as p; [print(x, '->', p(x)) for x in ['tests-build/src/lib.rs', 'tests-integration/src/lib.rs', 'tests-integration/tests/macros.rs', 'test-util/src/lib.rs']]"

On main:

tests-build/src/lib.rs -> production
tests-integration/src/lib.rs -> production
tests-integration/tests/macros.rs -> test
test-util/src/lib.rs -> test

Impact

Test-harness crates count toward hotspots, health and dead code as shipped code.

Done looks like

  • Choose the rule: a tests-* crate name at a workspace member root, or a Cargo manifest signal through the existing package_root probe. Record the ceiling in a comment.
  • Apply it in repowise.core.code_origin / test_paths.py, so every judge inherits it; no per-caller check.
  • A published crate whose name starts with tests stays production.
  • Help wanted: a judgement call on the signal, and possibly a manifest read at ingestion.

Tests

tests/unit/test_test_paths.py and tests/unit/test_code_origin.py: both crate paths are test; a published tests-* crate follows the chosen rule.

Dominant language
Python
Stars
7.1k
Forks
756
Avg merge
21h 5m
Merged PRs (30d)
797

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from repowise-dev/repowise

All issues in repowise-dev/repowise

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.