Skip to content

Commit cc3c648

Browse files
committed
docs: update Python coding guidelines to allow for Pytest test classes. It helps to make the code more readable and maintainable. Also, makes it possible to write shorter test method names to conform to our rules
1 parent 0aef245 commit cc3c648

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/copilot-instructions.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ applyTo: '**/*.py'
66
# Python Coding Conventions
77

88
## General Instructions
9+
910
- All configuration **must be provided via environment variables**.
1011
- Do not hardcode configuration values.
1112
- Write maintainable, readable, and predictable code.
@@ -17,23 +18,29 @@ applyTo: '**/*.py'
1718
- Use consistent naming conventions and follow language-specific best practices.
1819

1920
## Python Instructions
21+
2022
- Use type annotations (PEP 484) - except in the `tests/` folder.
21-
- All public functions, methods, and classes **must include [Google-style docstrings](https://google.github.io/styleguide/pyguide.html)**.
23+
- All public functions, methods, and classes **must
24+
include [Google-style docstrings](https://google.github.io/styleguide/pyguide.html)**.
2225
- **Do not add inline comments**; rely on clear code and docstrings instead.
2326
- Function and variable names must be explicit and intention-revealing.
24-
- `pyproject.toml` is the source of truth for code quality rules. Generated code must not violate any configured rules.
27+
- `pyproject.toml` is the source of truth for code quality rules. Generated code must not violate
28+
any configured rules.
2529
- **ruff** is the primary linter for general Python style and best practices.
2630
- **flake8** is used exclusively to run:
27-
- `wemake-python-styleguide` - Enforces strict Python coding standards ([docs](https://wemake-python-styleguide.readthedocs.io/en/latest/))
31+
- `wemake-python-styleguide` - Enforces strict Python coding
32+
standards ([docs](https://wemake-python-styleguide.readthedocs.io/en/latest/))
2833
- `flake8-aaa` - Validates the AAA pattern in tests
2934
- Follow PEP 8 unless explicitly overridden by ruff.
3035
- Prefer simple, explicit code over clever or compact implementations.
3136

3237
## Testing
38+
3339
- Use pytest only.
34-
- Tests must be written as **functions**, not classes.
40+
- Tests classes must use the `Test` prefix.
3541
- Test files and functions must use the `test_` prefix.
36-
- Follow ***AAA(Arrange - Act - Assert)*** strictly. See the [flake8-aaa documentation](https://flake8-aaa.readthedocs.io/en/stable/index.html).
42+
- Follow ***AAA(Arrange - Act - Assert)*** strictly. See
43+
the [flake8-aaa documentation](https://flake8-aaa.readthedocs.io/en/stable/index.html).
3744
- Do **not** use `if` statements or branching logic inside tests.
3845
- Prefer fixtures over mocks whenever possible.
3946
- Avoid duplicating test logic; extract shared setup into fixtures.

0 commit comments

Comments
 (0)