Skip to content

refactor: use python-gitlab in acceptance tests #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 17, 2023

Conversation

nejch
Copy link
Contributor

@nejch nejch commented Nov 22, 2022

Related to #73

A while ago I promised I'd give it a shot migrating to python-gitlab so we can collaborate more and reduce effort.
One of our users pinged me recently so I looked again now and the code is a bit involved to migrate as it's also reused in tests, so I thought maybe I can decouple the test code first and not touch production code.

Turns out, there's always more tests than code so this ended being a massive refactor 😅 Sorry, thought I'd start small but it seemed cleaner to migrate all tests. However, it was great that all testing is done as blackbox acceptance testing as I didn't need to change any mocks.

So, here's a massive PR if this is something you'd consider. Slightly ashamed of this chunky boy here but still 😁 I'll add PR notes on the changes a bit along the way. I haven't yet done the premium part as I need to set up a local instance now, but opening a draft just to get a general idea of the direction here.

  • did not touch production code except methods that are only used in test code. If needed, I can put them back, but they are no longer used in tests.
  • the major changes are in tests/acceptance/__init__.py and tests/acceptance/conftest.py, most of the test files are cosmetics due to dot-notation in python-gitlab objects.
  • reduced number of helpers and using fixtures instead, e.g. gl.has_no_license etc

Really sorry about the massive diff here 🙇

@nejch nejch had a problem deploying to Integrate Pull Request November 22, 2022 23:46 Failure
@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2022

Codecov Report

Merging #442 (60c1898) into main (7dab06c) will decrease coverage by 5.27%.
The diff coverage is n/a.

❗ Current head 60c1898 differs from pull request most recent head 8d62a54. Consider uploading reports for the commit 8d62a54 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #442      +/-   ##
==========================================
- Coverage   84.21%   78.94%   -5.27%     
==========================================
  Files          70       70              
  Lines        2679     2641      -38     
==========================================
- Hits         2256     2085     -171     
- Misses        423      556     +133     
Impacted Files Coverage Δ
gitlabform/gitlab/branches.py 61.76% <ø> (-25.96%) ⬇️
gitlabform/gitlab/core.py 87.12% <ø> (-7.70%) ⬇️
gitlabform/gitlab/groups.py 78.18% <ø> (-9.75%) ⬇️
gitlabform/gitlab/members.py 72.91% <ø> (-9.09%) ⬇️
gitlabform/gitlab/tags.py 80.00% <ø> (-20.00%) ⬇️
gitlabform/gitlab/users.py 44.44% <ø> (-47.87%) ⬇️
...labform/gitlab/project_merge_requests_approvals.py 20.83% <0.00%> (-66.67%) ⬇️
...itlabform/gitlab/project_protected_environments.py 42.85% <0.00%> (-35.72%) ⬇️
...orm/processors/project/merge_requests_approvals.py 70.00% <0.00%> (-30.00%) ⬇️
... and 16 more

@nejch nejch force-pushed the refactor/python-gitlab-tests branch from ccaf2cf to d0e1043 Compare November 22, 2022 23:59
@nejch nejch had a problem deploying to Integrate Pull Request November 23, 2022 00:00 Failure
@nejch nejch force-pushed the refactor/python-gitlab-tests branch from d0e1043 to 0b6fb94 Compare November 23, 2022 00:01
@nejch nejch had a problem deploying to Integrate Pull Request November 23, 2022 00:01 Failure
@nejch nejch force-pushed the refactor/python-gitlab-tests branch from 0b6fb94 to 3961751 Compare November 23, 2022 00:20
@nejch nejch had a problem deploying to Integrate Pull Request November 23, 2022 00:20 Failure
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.4% 0.4% Duplication

@nejch nejch marked this pull request as ready for review November 23, 2022 00:44
@gdubicki
Copy link
Member

gdubicki commented Nov 24, 2022

Hey @nejch!

Many thanks for your effort! I absolutely do not think that it is bad that this is a big PR - it is great that you covered almost all of the tests in one shot.

Maybe I will try to do the remaining premium ones myself so I can see how the conversion works?

The only thing that slightly blocks merging this is the final release of v3.4.0. I want to complete work on that first as it contains the long-awaited feature AND also a big refactor and it's almost ready to be released.

@nejch
Copy link
Contributor Author

nejch commented Nov 25, 2022

Hey @nejch!

Many thanks for your effort! I absolutely do not think that it is bad that this is a big PR - it is great that you covered almost all of the tests in one shot.

Maybe I will try to do the remaining premium ones myself so I can see how the conversion works?

The only thing that slightly blocks merging this is the final release of v3.4.0. I want to complete work on that first as it contains the long-awaited feature AND also a big refactor and it's almost ready to be released.

@gdubicki ah that's great to hear! No worries about doing another release first. I can clean this up a bit in the meantime (starting to get conflicts). Should I wait and rebase after the v3.4.0 release?

That makes sense if you want to try out premium as well, just let me know how you want to proceed (merge to another branch, or you just take over directly from this PR, etc)? :)

@nejch
Copy link
Contributor Author

nejch commented Dec 19, 2022

@gdubicki if I understand correctly I can start rebasing once 3.4.0 is out right? I'm starting to see some conflicts so not sure if I should keep this up to date here already :)

@gdubicki
Copy link
Member

@gdubicki if I understand correctly I can start rebasing once 3.4.0 is out right? I'm starting to see some conflicts so not sure if I should keep this up to date here already :)

Yes. Sorry for keeping you waiting but I've been busier than I thought lately and it's hard for me to complete that 3.4.0...

@gdubicki
Copy link
Member

v3.4.0 has been released today.

It would be great if you could try to rebase this PR, @nejch.

@gdubicki gdubicki force-pushed the refactor/python-gitlab-tests branch from 3961751 to b5377a7 Compare January 28, 2023 22:55
@gdubicki gdubicki had a problem deploying to Integrate Pull Request January 28, 2023 22:56 — with GitHub Actions Failure
@gdubicki gdubicki force-pushed the refactor/python-gitlab-tests branch from b5377a7 to 75d1f0c Compare January 28, 2023 23:04
@gdubicki gdubicki had a problem deploying to Integrate Pull Request January 28, 2023 23:05 — with GitHub Actions Failure
@nejch
Copy link
Contributor Author

nejch commented Jan 29, 2023

Hey @gdubicki thanks for the ping and sorry for the delay 😊 I see you've already resolved the conflicts, thanks!

I can work on finishing the premium tests some time next week/weekend if that works for you? Or would you prefer to work on that?

@gdubicki
Copy link
Member

Hey @gdubicki thanks for the ping and sorry for the delay 😊 I see you've already resolved the conflicts, thanks!

I can work on finishing the premium tests some time next week/weekend if that works for you? Or would you prefer to work on that?

Yes, I resolved conflicts in the standard tests but it would be great if you could update the premium ones.

@gdubicki
Copy link
Member

Ugh, the new black version forced me to remove some empty lines and now git can't handle merging that? :/

@glensc
Copy link
Contributor

glensc commented Feb 17, 2023

add revert commit to this branch of the black changes of matching files? :)

@nejch nejch force-pushed the refactor/python-gitlab-tests branch from 75d1f0c to 39c27aa Compare March 5, 2023 10:26
@nejch nejch had a problem deploying to Integrate Pull Request March 5, 2023 10:26 — with GitHub Actions Failure
@nejch
Copy link
Contributor Author

nejch commented Mar 5, 2023

@gdubicki @glensc I just did a sneaky git rebase -Xtheirs main and reapplied black on the new changes 😅 we can squash later if you like.

I'll work on this today, thanks for putting up with my glacial speeds.

Edit: almost there, needs a bit more tweaking.

@nejch nejch had a problem deploying to Integrate Pull Request March 6, 2023 00:58 — with GitHub Actions Failure
@nejch nejch force-pushed the refactor/python-gitlab-tests branch from 050fc41 to 4803d4a Compare March 6, 2023 02:17
@nejch nejch had a problem deploying to Integrate Pull Request March 6, 2023 02:17 — with GitHub Actions Failure
@nejch nejch force-pushed the refactor/python-gitlab-tests branch from 4803d4a to d5fa066 Compare March 6, 2023 02:22
@nejch nejch had a problem deploying to Integrate Pull Request March 6, 2023 02:22 — with GitHub Actions Failure
@nejch nejch force-pushed the refactor/python-gitlab-tests branch from d5fa066 to 60c1898 Compare March 6, 2023 10:21
@nejch nejch had a problem deploying to Integrate Pull Request March 6, 2023 10:22 — with GitHub Actions Failure
@nejch
Copy link
Contributor Author

nejch commented Mar 6, 2023

@gdubicki I think this should be ready now 🙇 I've resolved some of the comments so it's not too noisy but feel free to expand to see the reasoning.

@nejch nejch temporarily deployed to Integrate Pull Request March 7, 2023 22:04 — with GitHub Actions Inactive
@nejch
Copy link
Contributor Author

nejch commented Mar 14, 2023

@gdubicki I pushed another small commit here last week, would be interested to see if it's all green for Premium as well, would you mind approving the premium deployment? :)

@gdubicki gdubicki merged commit c064288 into gitlabform:main Mar 17, 2023
@gdubicki
Copy link
Member

Thank you again for all your work on this @nejch! All tests have been passing, so I am happy to be able to merge. 😊

@gdubicki gdubicki had a problem deploying to Integrate Pull Request March 17, 2023 22:04 — with GitHub Actions Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy