Skip to content
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

Add testing support using VCR.py #78

Merged
merged 3 commits into from
Nov 23, 2023
Merged

Add testing support using VCR.py #78

merged 3 commits into from
Nov 23, 2023

Conversation

gridhead
Copy link
Member

Add testing support using VCR.py

Fixes #42

@gridhead gridhead added the enhancement New feature or request label Nov 21, 2023
@gridhead gridhead self-assigned this Nov 21, 2023
Also, moved out PyCharm related configuration to be considered by the Version Control System and added the testing schematic in the Tox configuration

Signed-off-by: Akashdeep Dhar <[email protected]>
@gridhead
Copy link
Member Author

I used this library to speed things up significantly and use fewer resources when it comes to testing HTTP API requests made to Pagure and GitLab. The documentation/blogpost here was handy in helping me to set up VCR.py.

@Zlopez I could use a review here.

@gridhead
Copy link
Member Author

One of the previous test runs actually connected to GitLab.com to make testing HTTP API requests and used a lot of networking and computing resources while taking as long 3 minutes and 11 seconds to complete. As external services are used, the reliability of the testcases also depend on the services' health, network conditions etc.

With the use of VCR.py, only those HTTP API requests are conveyed all the way up to GitLab.com that are required to test the functionality of cloning and transferring the repository assets. The responses to the majority of HTTP API requests are emulated in this test run and that brings down the time to as low as 1 minute and 14 seconds.

That is approximately 61.25% time saved on test runs with significant improvement on the reliability of those!

@gridhead gridhead requested a review from Zlopez November 21, 2023 18:47
Copy link

@samyak-jn samyak-jn left a comment

Choose a reason for hiding this comment

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

this looked intimidating when I saw +25,436 −137; but then I checked how smartly you added @pytest.mark.vcr(filter_headers=["Authorization"]) to the test cases that's why i checked in my review that it should be included in all the test cases!

@gridhead
Copy link
Member Author

Thanks for the review, @samyak-jn!

@gridhead gridhead merged this pull request into main Nov 23, 2023
4 checks passed
gridhead added a commit that referenced this pull request Dec 13, 2023
Add testing support using VCR.py
@gridhead gridhead deleted the record branch December 14, 2023 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use VCR.py for unit tests
2 participants