Skip to content

Common Unit Test Rules #989

@hiroshinishio

Description

@hiroshinishio

Test Coding Rule

  • Do not use class in test code. Always prefer plain function style, even for mocks.
  • Ensure comprehensive test coverage, including extreme edge cases.
  • No comments in the code.
  • No corresponding URLs in the code.

Test File Path Rule

  • Place test files next to the target files instead of creating a separate tests folder. Do not use dedicated test directories like tests/ or __tests__
  • Name test files with the pattern test_{original_filename}.py

Test Constant Rule

  • Use OWNER in tests/constants.py for an owner
  • Use REPO in tests/constants.py for a repo
  • Use FORKED_REPO in tests/constants.py for a forked repo if necessary
  • Use TOKEN in tests/constants.py for a token
  • If you introduce any test constant used more than once, define it in tests/constants.py and reference it from there.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions