Skip to main content

pytest-gitlab-fold

Tests PyPI

Pytest plugin that folds output sections in GitLab CI build log.

It is a port of Eldar Abusalimov's excellent pytest-travis-fold plugin, all credits go to him and contributors.

GitLab CI build log view

In addition, pytest-gitlab-fold recognizes presence of the pytest-cov plugin and folds coverage reports accordingly.

Installation and Usage

Just install the [pytest-gitlab-fold][linnk-pypi] package as part of your build.

When using tox, add the package to the deps list in your tox.ini and make sure the GITLAB_CI environment variable is passed:

[testenv]
deps =
    pytest-gitlab-fold
passenv = GITLAB_CI

If you don't use tox and invoke py.test directly from .gitlab-ci.yml, you may install the package as an additional install step:

install:
  - pip install -e .
  - pip install pytest-gitlab-fold

script: py.test

Output folding is enabled automatically when running inside GitLab CI. It is OK to have the plugin installed also in your dev environment: it is only activated by checking the presence of the GITLAB_CI environmental variable, unless the --gitlab-fold command line switch is used.

The gitlab fixture

The plugin by itself only makes the captured output sections appear folded. If you wish to make the same thing with arbitrary lines, you can do it manually by using the gitlab fixture.

It is possible to fold the output of a certain code block using the gitlab.folding_output() context manager:

def test_something(gitlab):
    with gitlab.folding_output():
        print("Lines, lines, lines...")
        print("Lots of them!")
        ...

Or you may want to use lower-level gitlab.fold_string() and gitlab.fold_lines() functions and then output the result as usual.

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, "pytest-gitlab-fold" is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Metadata

Release files for pytest-gitlab-fold 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-fold 0.3.1
File Size Uploaded
pytest-gitlab-fold-0.3.1.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-gitlab-fold 0.3.1
File Interpreter ABI Platform
pytest_gitlab_fold-0.3.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 17.0 kB

Release files / pytest-gitlab-fold-0.3.1.tar.gz

Download URL pytest-gitlab-fold-0.3.1.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9257675267cb4c4291cffc678ffebd486b127429f5f7fd9fbf6e156bc236d9dc
BLAKE2b-256 checksum
How to use checksums
022693c0cfeabe80c1407056c369b2aea34f83c5f54e2f2f1903907f75b2eea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / pytest_gitlab_fold-0.3.1-py2.py3-none-any.whl

Download URL pytest_gitlab_fold-0.3.1-py2.py3-none-any.whl
Size 7.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
81c923a5243d0c7daf6b6e50253f71e84d6f7d42c20cc723c9b3d41ae6936b50
BLAKE2b-256 checksum
How to use checksums
744e0ffe114783291430423c41848ce1690488dcc7ce0044dd93bf692e7cea14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.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