Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@ptalbert
Copy link

Fixes: #3046

This takes the pytest-gitlab plugin from https://gitlab.com/thht_science_software/pytest-gitlab and puts it in gitlab/testing/. It is then exposed as a pytest plugin "gitlab" and the existing tests/ fixtures are removed.

…direnv

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
Code is taken from tag v0.3.1.dev0 (8aaa35d2).

- remove `__version__.py` file from pytest-gitlab
- maintain python-gitlab docker/.env
- adjust imports to use `gitlab.testing` instead of `pytest-gitlab`
- make `plugin.py` imports relative
- add mypy override for `gitlab.testing.*`
- create a `testing` optional dependency
- add pytest plugin entrypoint `gitlab`
- change from single quotes to double quotes (thanks to black
  formatting)

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
Bring in the changes from cbc613d ('test(functional): switch to new
runner registration API').

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
…ugin

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
IMHO this makes it more clear what this is.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
… is present

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
@ptalbert
Copy link
Author

All the existing tests pass when I run tox, however, I am struggling to get api_func_v4 and cli_func_v4 to run even on the original main branch. Still working on it...

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
It needs to be `module`, not `function`, otherwise there will be a lot
of ScopeMismatch errors.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
These assets are specific to the functional tests of python-gitlab and
do not belong as part of the pytest-gitlab plugin.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

❌ Patch coverage is 60.16484% with 145 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.21%. Comparing base (4221195) to head (3711b46).

Files with missing lines Patch % Lines
gitlab/testing/fixtures/gitlab.py 60.95% 114 Missing ⚠️
gitlab/testing/fixtures/helpers.py 60.97% 16 Missing ⚠️
gitlab/testing/docker/docker.py 40.00% 6 Missing ⚠️
gitlab/testing/fixtures/meta.py 66.66% 6 Missing ⚠️
gitlab/testing/plugin.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3313       +/-   ##
===========================================
- Coverage   95.72%   84.21%   -11.51%     
===========================================
  Files          98      103        +5     
  Lines        6052     6424      +372     
===========================================
- Hits         5793     5410      -383     
- Misses        259     1014      +755     
Flag Coverage Δ
api_func_v4 72.57% <53.29%> (-11.08%) ⬇️
cli_func_v4 67.82% <53.57%> (-10.87%) ⬇️
unit 75.94% <6.59%> (-14.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
gitlab/testing/plugin.py 0.00% <0.00%> (ø)
gitlab/testing/docker/docker.py 27.77% <40.00%> (ø)
gitlab/testing/fixtures/meta.py 66.66% <66.66%> (ø)
gitlab/testing/fixtures/helpers.py 60.97% <60.97%> (ø)
gitlab/testing/fixtures/gitlab.py 60.95% <60.95%> (ø)

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@nejch nejch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptalbert thank you so much for tackling this! I think some of this might need updating to match our current testing environment, since pytest-gitlab was last updated in 2024 from what I can see. It might also help fix the test failures, as we recently also updated that to make it work on GitLab 18.x.

To make that a bit more manageable, would it make sense to split this into smaller PRs - e.g. prepare the changes needed so that the final PR is mostly just copying files? That would make things easier to review as well I think 🙇 thanks!

- ruby /create_license.rb && /assets/wrapper
volumes:
- ${PWD}/tests/functional/fixtures/create_license.rb:/create_license.rb
- ./create_license.rb:/create_license.rb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this definitely work (i.e. it will be relative to the compose config file) regardless of where the tests are executed from? Just making sure, I know that different compose implementations have different behavior 🙇

We had some issues in the past when we tried to migrate to compose v2, so just wanted to check.

services:
gitlab:
image: '${GITLAB_IMAGE}:${GITLAB_TAG}'
image: '${GITLAB_IMAGE:-gitlab/gitlab-ee}:${GITLAB_TAG:-latest}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe extract the preparation changes (everything that can be applied without moving the plugin) into a separate PR that we merge first? Just so we can focus on integration aspects here. Let me know otherwise I can also try that on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorporate pytest-gitlab plugin back into python-gitlab

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.