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

One server for unit tests #203

Merged
merged 2 commits into from
Oct 26, 2020
Merged

One server for unit tests #203

merged 2 commits into from
Oct 26, 2020

Conversation

ca-johnson
Copy link
Contributor

@ca-johnson ca-johnson commented Oct 22, 2020

  • Modify scope of fixture to create the server one time and re-use it for each test
  • p4trust is a property of client rather than server - move that file into the unit tests where it is relevant, in tmpdir for client

Improves time to run unit tests locally:

Initial:
$ python -m pytest python/test_perforce.py    
=== 19 passed in 25.80s ===

With change:
$ python -m pytest python/test_perforce.py    
=== 19 passed in 7.16s ===

With pytest-xdist:
$ python -m pytest python/test_perforce.py --numprocesses=auto  
=== 19 passed in 3.98s ===

@ca-johnson ca-johnson requested a review from petemounce October 22, 2020 16:20
@improbable-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: petemounce
To complete the pull request process, please assign
You can assign the PR to them by writing /assign in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ca-johnson
Copy link
Contributor Author

ca-johnson commented Oct 23, 2020

Noticed that when a unit test fails (with this PR), there is a lot of spam due to attempts to write to a log that is already closed. Will try to resolve this prior to merge

@ca-johnson
Copy link
Contributor Author

ca-johnson commented Oct 26, 2020

I was able to narrow the above down to the use of capsys in test_server_fixture unit test.

We could remove this, but it makes it harder to see what port the server is running on when trying to modify the server fixture.

Its possible that this is fixed in a newer version of pytest, which dependabot has a PR open for: #197

Its not a huge deal, but probably worth looking into to remove the distracting logging errors vs failure

Ticketed at #204

Going to merge this for now, since it makes it noticeably faster to iterate on resolving this.

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.

3 participants