Files
gitlab-foss/doc/development/python_guide/styleguide.md
2025-02-04 03:18:21 +00:00

1.4 KiB

stage, group, info, title
stage group info title
none unassigned Any user with at least the Maintainer role can merge updates to this content. For details, see https://docs.gitlab.com/ee/development/development_processes.html#development-guidelines-review. Python style guide

Testing

Overview

Testing at GitLab, including in Python codebases is a core priority rather than an afterthought. It is therefore important to consider test design quality alongside feature design from the start.

Use Pytest for Python testing.

Testing levels

Before writing tests, understand the different testing levels and determine the appropriate level for your changes.

Learn more about the different testing levels, and how to decide at what level your changes should be tested.

Recommendation when mocking

  • Use unittest.mock library.
  • Mock at the right level, for example, at method call boundaries.
  • Mock external services and APIs.

Testing in Python vs. Ruby on Rails