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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(cli): convert CLI shell tests to pytest test cases #1086

Merged
merged 1 commit into from Apr 29, 2020

Conversation

nejch
Copy link
Member

@nejch nejch commented Apr 26, 2020

An initial attempt at unifying the testing approach 馃榿

This PR uses the pytest-console-scripts plugin and provides a gitlab_cli() wrapper for tests, so people can add gitlab CL subcommands as a list and include variables (from the test case or from fixtures) to assert against.

I'm unsure if this is really the best approach, but I've already been impressed while building this by how much more detail pytest provides for each error/failure, even when running CLI tests. If I did the fixtures right, they should also later be reusable for API functional tests. :P

For now I've not split the tests yet, to make reviews easier (1 shell test -> 1 pytest test), which makes the file quite long. I guess it would also make sense to split them. This would be better anyway, and this should make tests not depend on each other (I'm almost there even now - still have a few todos for some fixtures).

If this approach makes sense I can add some docs on how to contribute tests to make it more accessible for new contributors, :)

An example run is here: https://travis-ci.org/github/python-gitlab/python-gitlab/jobs/679739257

Edit: I've also not yet put this inside gitlab/tests yet, to avoid hacking the tox scripts, but I guess the structure will also be a topic

@nejch nejch marked this pull request as ready for review April 26, 2020 15:28
@nejch nejch requested a review from max-wittig April 26, 2020 15:28
@codecov-io
Copy link

Codecov Report

Merging #1086 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1086   +/-   ##
=======================================
  Coverage   76.68%   76.68%           
=======================================
  Files          10       10           
  Lines        2758     2758           
=======================================
  Hits         2115     2115           
  Misses        643      643           

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 91c1c27...c4ab4f5. Read the comment docs.

@max-wittig max-wittig merged commit 74b3ddc into master Apr 29, 2020
@max-wittig max-wittig deleted the test/pytest-cli-tests branch April 29, 2020 10:07
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.

None yet

3 participants