Skip to content

Add "Naming convention" to test_cases/README.md #8521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 13, 2022

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Aug 10, 2022

Refs #8520

Use the same top-level name for the module / package you would like to test.
Use `test_${thing}.py` naming pattern for individual test files.
For example:
- Tests for `gather` defined in `stdlib/asyncio/tasks.pyi` will go into `stdlib/asyncio/test_gather.py`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Tests for `gather` defined in `stdlib/asyncio/tasks.pyi` will go into `stdlib/asyncio/test_gather.py`
- Tests for `gather` defined in `stdlib/asyncio/tasks.pyi` will go into `stdlib/asyncio/tasks/test_gather.py`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use `test_${thing}.py` naming pattern for individual test files.
For example:
- Tests for `gather` defined in `stdlib/asyncio/tasks.pyi` will go into `stdlib/asyncio/test_gather.py`
- Tests for `ExitStack` defined in `stdlib/contextlib.pyi` will go into `stdlib/test_contextlib.py`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These examples don't show why ExitStack goes into test_contextlib directly, but pow doesn't go into test_builtins. We should add something like "By default, tests go into a test file with the same name as the stub file, prefixed with test_. For example: test_contextlib. If that file becomes too big, we instead create a directory with files named after individual objects being tested. For example: builtins/test_dict."

sobolevn and others added 2 commits August 10, 2022 17:02
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@JelleZijlstra JelleZijlstra merged commit d53d325 into python:master Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants