pypa / pypa/setuptools

[FR] Extend the default tests glob inclusion

Open
#4,460 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Needs Triage
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

What's the problem this feature will solve?

The docs @ https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html#controlling-files-in-the-distribution say:

  • Files that match the following glob patterns: tests/test*.py, test/test*.py;

Test files that have _test suffix in their base name are not included automatically. This is one of the common naming conventions. They should.

Describe the solution you'd like

Including test files that have _test suffix in base name would be super useful. Additionally, does this recognize well-known names like conftest.py?

Alternative Solutions

No response

Additional context

The example is a pyproject.toml looking as follows:

[build-system]
requires = [
  "setuptools",
]
build-backend = "setuptools.build_meta"

[project]
name = "lokiverse"
version = "1.0.0"
dependencies = [
  "cheroot",
]

The project has an src/ layout with top-level tests/ and the file at tests/api_test.py is not included.

Code of Conduct
  • I agree to follow the PSF Code of Conduct

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start with the documentation section on controlling files in the distribution and reproduce the reported src-layout case using the shown pyproject.toml and tests/api_test.py. Check how the default test-file globs handle the existing test*.py patterns, _test suffixes, and conftest.py. Done means the intended files are included automatically and the documentation accurately describes the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.