# pytest-gitlab-fold
[![Tests][badge-tests]][link-tests]
[![PyPI][badge-pypi]][link-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](docs/screenshot.png)
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:
```ini
[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:
```yaml
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:
```python
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] license, "pytest-gitlab-fold" is
free and open source software.
## Issues
If you encounter any problems, please [file an issue][issues] along with a detailed
description.
[badge-pypi]: https://img.shields.io/pypi/v/pytest-gitlab-fold
[badge-tests]: https://img.shields.io/github/actions/workflow/status/aerilius/pytest-gitlab-fold/tests.yml?branch=main&label=tests
[issues]: https://github.com/aerilius/pytest-gitlab-fold/issues
[license]: http://opensource.org/licenses/MIT
[link-pypi]: https://pypi.org/project/pytest-gitlab-fold/
[link-tests]: https://github.com/aerilius/pytest-gitlab-fold/actions/workflows/tests.yml
[pytest]: https://github.com/pytest-dev/pytest
[pytest-cov]: https://github.com/pytest-dev/pytest-cov
[pytest-travis-fold]: https://github.com/abusalimov/pytest-travis-fold
[tox]: https://tox.readthedocs.org/en/latest
Raw data
{
"_id": null,
"home_page": "",
"name": "pytest-gitlab-fold",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "pytest,gitlab,build,logs,continuous,integration",
"author": "",
"author_email": "Andreas Eisenbarth <aerilius@gmail.com>, Eldar Abusalimov <eldar.abusalimov@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/02/26/93c0cfeabe80c1407056c369b2aea34f83c5f54e2f2f1903907f75b2eea7/pytest-gitlab-fold-0.3.1.tar.gz",
"platform": null,
"description": "# pytest-gitlab-fold\n\n[![Tests][badge-tests]][link-tests]\n[![PyPI][badge-pypi]][link-pypi]\n\n[Pytest] plugin that folds output sections in GitLab CI build log.\n\nIt is a port of Eldar Abusalimov's excellent [pytest-travis-fold] plugin,\nall credits go to him and contributors.\n\n![GitLab CI build log view](docs/screenshot.png)\n\nIn addition, pytest-gitlab-fold recognizes presence of the [pytest-cov]\nplugin and folds coverage reports accordingly.\n\n## Installation and Usage\n\nJust install the \\[pytest-gitlab-fold\\]\\[linnk-pypi\\] package\nas part of your build.\n\nWhen using [tox], add the package to the `deps` list in your `tox.ini`\nand make sure the `GITLAB_CI` environment variable is passed:\n\n```ini\n[testenv]\ndeps =\n pytest-gitlab-fold\npassenv = GITLAB_CI\n```\n\nIf you **don't** use tox and invoke `py.test` directly from `.gitlab-ci.yml`,\nyou may install the package as an additional `install` step:\n\n```yaml\ninstall:\n - pip install -e .\n - pip install pytest-gitlab-fold\n\nscript: py.test\n```\n\nOutput folding is enabled automatically when running inside GitLab CI. It is OK\nto have the plugin installed also in your dev environment: it is only activated\nby checking the presence of the `GITLAB_CI` environmental variable, unless the\n`--gitlab-fold` command line switch is used.\n\n## The `gitlab` fixture\n\nThe plugin by itself only makes the captured output sections appear folded.\nIf you wish to make the same thing with arbitrary lines, you can do it manually\nby using the `gitlab` fixture.\n\nIt is possible to fold the output of a certain code block using the\n`gitlab.folding_output()` context manager:\n\n```python\ndef test_something(gitlab):\n with gitlab.folding_output():\n print(\"Lines, lines, lines...\")\n print(\"Lots of them!\")\n ...\n```\n\nOr you may want to use lower-level `gitlab.fold_string()` and\n`gitlab.fold_lines()` functions and then output the result as usual.\n\n## Contributing\n\nContributions are very welcome. Tests can be run with [tox], please ensure\nthe coverage at least stays the same before you submit a pull request.\n\n## License\n\nDistributed under the terms of the [MIT][license] license, \"pytest-gitlab-fold\" is\nfree and open source software.\n\n## Issues\n\nIf you encounter any problems, please [file an issue][issues] along with a detailed\ndescription.\n\n[badge-pypi]: https://img.shields.io/pypi/v/pytest-gitlab-fold\n[badge-tests]: https://img.shields.io/github/actions/workflow/status/aerilius/pytest-gitlab-fold/tests.yml?branch=main&label=tests\n[issues]: https://github.com/aerilius/pytest-gitlab-fold/issues\n[license]: http://opensource.org/licenses/MIT\n[link-pypi]: https://pypi.org/project/pytest-gitlab-fold/\n[link-tests]: https://github.com/aerilius/pytest-gitlab-fold/actions/workflows/tests.yml\n[pytest]: https://github.com/pytest-dev/pytest\n[pytest-cov]: https://github.com/pytest-dev/pytest-cov\n[pytest-travis-fold]: https://github.com/abusalimov/pytest-travis-fold\n[tox]: https://tox.readthedocs.org/en/latest\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Folds output sections in GitLab CI build log",
"version": "0.3.1",
"project_urls": {
"Repository": "https://github.com/aerilius/pytest-gitlab-fold"
},
"split_keywords": [
"pytest",
"gitlab",
"build",
"logs",
"continuous",
"integration"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "744e0ffe114783291430423c41848ce1690488dcc7ce0044dd93bf692e7cea14",
"md5": "24c8fcffe92c093dd06ada6cc2a7a2c0",
"sha256": "81c923a5243d0c7daf6b6e50253f71e84d6f7d42c20cc723c9b3d41ae6936b50"
},
"downloads": -1,
"filename": "pytest_gitlab_fold-0.3.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "24c8fcffe92c093dd06ada6cc2a7a2c0",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 7634,
"upload_time": "2023-12-31T17:58:20",
"upload_time_iso_8601": "2023-12-31T17:58:20.706229Z",
"url": "https://files.pythonhosted.org/packages/74/4e/0ffe114783291430423c41848ce1690488dcc7ce0044dd93bf692e7cea14/pytest_gitlab_fold-0.3.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "022693c0cfeabe80c1407056c369b2aea34f83c5f54e2f2f1903907f75b2eea7",
"md5": "d4f7be0f5abccd0870f423174c3a0f97",
"sha256": "9257675267cb4c4291cffc678ffebd486b127429f5f7fd9fbf6e156bc236d9dc"
},
"downloads": -1,
"filename": "pytest-gitlab-fold-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "d4f7be0f5abccd0870f423174c3a0f97",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9324,
"upload_time": "2023-12-31T17:58:21",
"upload_time_iso_8601": "2023-12-31T17:58:21.674492Z",
"url": "https://files.pythonhosted.org/packages/02/26/93c0cfeabe80c1407056c369b2aea34f83c5f54e2f2f1903907f75b2eea7/pytest-gitlab-fold-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-31 17:58:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aerilius",
"github_project": "pytest-gitlab-fold",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pytest-gitlab-fold"
}