Python tests: `*_tests.py` (mkdocs/tests/*_tests.py, discovered with `unittest discover -p "*tests.py"`) is not a test file pattern

Open Beginner friendly
#255 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
tooling

Research direction

The file pattern lives in PYTHON_TEST_FILES in ecosystems/python/init.py around lines 289-292; read the regex and the TestFiles usage first. Extend it so *_tests.py files and files under a tests/ directory are recognised, using the repro pkg/tests/build_tests.py containing unittest.TestCase. Done when that file is detected and the existing test_*.py and *_test.py cases still match.

Written by the indexing model from the issue text.

Description

mkdocs: FAIL "no tests found (test_*.py or *_test.py files)" for 12 mkdocs/tests/*_tests.py files in a tests/ directory. When unittest discover -p names a pattern, use it; *_tests.py under tests/ is common anyway.

Evidence from the corpus audit

mkdocs/mkdocs / tests-run (test file pattern)
  • kind: FALSE_NEGATIVE
  • actual: FAIL "Python: no tests found (test_*.py or *_test.py files)".
  • expected: tests found: mkdocs/tests/*_tests.py (12 files in a tests/ directory), discovered by CI with
    unittest discover -p "*tests.py".
  • evidence: ls mkdocs/tests → build_tests.py, cli_tests.py, config/, gh_deploy_tests.py, ...;
    pyproject.toml:122: test = 'python -m unittest discover -s mkdocs -p "*tests.py"'. Validator:
    ecosystems/python/__init__.py:289-292: PYTHON_TEST_FILES = TestFiles(... path=re.compile(r"(?:^|/)(?:test_[^/]*| [^/]*_test)\.py$")) — _tests.py (plural) and files under a tests/ directory do not match.
  • repro: pkg/tests/build_tests.py containing unittest.TestCase.
  • confidence: medium (unusual naming, but the tests/ directory is unambiguous and the discover pattern is readable)

Found by the regression-corpus audit (235 real repositories, one or more per ecosystem profile; corpus and expected results in corpus/). Evidence is quoted from the audited checkouts at the commits pinned in corpus/projects.toml; <checkouts>/<owner>__<repo> is such a checkout.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt

Dominant language
Python
Stars
4
Forks
1
Avg merge
10h 41m
Merged PRs (30d)
79

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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 cpp-best-practices/project_validator

All issues in cpp-best-practices/project_validator

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.