Skip to main content

GitLab Code Quality for Pytest

current package version supported Python versions github sponsors license

Enables GitLab to collect and show warnings emitted during your test runs through their [code quality report].

Terminal GitLab
Pytest warnings in the terminal Pytest warnings in the GitLab merge request widget

If you run GitLab Premium or Ultimate, you should even see the warnings right next to the code in the diff view of merge requests. The official documentation contains more information and screenshots.

Getting Started

Install the plugin using a package manager of your choice

pip install pytest-gitlab-code-quality

then specify the output location for the report using the --gitlab-code-quality-report option

pytest --gitlab-code-quality-report=pytest-warnings.json

In GitLab CI, this will look similar to this:

# .gitlab-ci.yml
pytest:
  stage: test
  image: python
  script:
    - pip install -r requirements.txt # Or however you install your dependencies
    - python -m pytest --gitlab-code-quality-report=pytest-warnings.json

  # The three lines below are required in order for the warnings to show up!
  artifacts:
    reports:
      codequality: pytest-warnings.json

Motivation

Some warnings are only surfaced during runtime, so static analyzers do not always catch them. The screenshots at the top of this document contain the example of a questionably configured SQLAlchemy model. Tests are a cheap way to surface such issues.

While you may run the tests locally and see these warnings there, you also might overlook them or don't know whether they were introduced by your changes or were already present before. Either way, I think it makes sense to explicitly surface and track them during code review instead of burying them in the CI logs that nobody looks at when the tests pass. And that is exactly why this plugin was created.

Release files for pytest-gitlab-code-quality 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-gitlab-code-quality 0.3.1
File Size Uploaded
pytest_gitlab_code_quality-0.3.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-gitlab-code-quality 0.3.1
File Interpreter ABI Platform
pytest_gitlab_code_quality-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / pytest_gitlab_code_quality-0.3.1.tar.gz

Download URL pytest_gitlab_code_quality-0.3.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
611cd9d9d21ea47babab840d040894a6180bb5b17be46f4c249785722b871916
BLAKE2b-256 checksum
How to use checksums
a98955c6c751fbe0fac8f856fae6a317f9290330ed83dc1164fc02968ea7ce3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.

Transparency log

Release files / pytest_gitlab_code_quality-0.3.1-py3-none-any.whl

Download URL pytest_gitlab_code_quality-0.3.1-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68d7536b989cd44e37cb2210045bc95e64ca7169be940d6ff3a37cc742e728a3
BLAKE2b-256 checksum
How to use checksums
d0e1bd7b1968ce044d0f0a1cd780cb19917c126cfaccf3608b08548def2fc822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page