Skip to content

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.

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

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

❌ Patch coverage is 0% with 374 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.17%. Comparing base (d8d8e7f) to head (5414694).

Files with missing lines Patch % Lines
gitlab/testing/fixtures/gitlab.py 0.00% 299 Missing ⚠️
gitlab/testing/fixtures/helpers.py 0.00% 42 Missing ⚠️
gitlab/testing/fixtures/meta.py 0.00% 18 Missing ⚠️
gitlab/testing/docker/docker.py 0.00% 12 Missing ⚠️
gitlab/testing/plugin.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3313      +/-   ##
==========================================
- Coverage   95.75%   90.17%   -5.58%     
==========================================
  Files          98      103       +5     
  Lines        6051     6425     +374     
==========================================
  Hits         5794     5794              
- Misses        257      631     +374     
Flag Coverage Δ
api_func_v4 78.78% <0.00%> (-4.92%) ⬇️
cli_func_v4 74.10% <0.00%> (-4.59%) ⬇️
unit 84.93% <0.00%> (-5.25%) ⬇️

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 0.00% <0.00%> (ø)
gitlab/testing/fixtures/meta.py 0.00% <0.00%> (ø)
gitlab/testing/fixtures/helpers.py 0.00% <0.00%> (ø)
gitlab/testing/fixtures/gitlab.py 0.00% <0.00%> (ø)
🚀 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!

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.

Copy link
Author

Choose a reason for hiding this comment

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

I didn't realize there was so much drift between the fixtures in pytest-gitlab and python-gitlab fixtures.

To hopefully simplify things, I've redone this PR using the current python-gitlab fixtures as the starting point. It adds the pytest-gitlab plugin but stops short of having the existing tests use any of it. A follow up PR can switch the tests over.

Hopefully this makes more sense. Let me know.

…direnv

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
Take the framework of pytest-gitlab but use the current python-gitlab
functional testing fixtures.

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>
The previous commit adds a new pytest plugin `pytest-gitlab` but does
not (yet) update the existing tests to use it. For now it needs to
explicitly be disabled when running tests so it does not interfere with
the original fixtures.

Since tox now runs the tests with `-p no:gitlab` the
test_gitflab_plugin_is_loaded test will always fail.
Skip it for now and instead ensure the entrypoint is at least there.

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

ptalbert commented Jan 7, 2026

I suppose the codecov report is lighting up because this PR does not actually exercise the gitlab/testing/ code any more.

As I see it the options are:

  1. exclude gitlab/testing/ dir from the check
  2. add a separate set of tests for all the gitlab/testing/ fixtures
  3. change over the existing tests/ to use the new pytest-gitlab plugin

Doing #1 as a temporary solution seems best if we do not want to do #3 yet. #2 would be great but that is a large undertaking.

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