Skip to content

Mock 100% coverage #13045

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 13 commits into from
May 1, 2019
Merged

Mock 100% coverage #13045

merged 13 commits into from
May 1, 2019

Conversation

cjw296
Copy link
Contributor

@cjw296 cjw296 commented May 1, 2019

Get Mock to 100% coverage and clean up a few things along the way.

cjw296 added 13 commits May 1, 2019 22:36
Otherwise coverage measurement over this package gets seriously out of whack.
If this functionality is ever needed, the tests can be added then.
This is mainly moving pass statements onto the same line as their def statement, but this pattern is easy to match in an "ignore" rule should anyone ever brave branch coverage ;-)
This will need to be brought back or skipped on the backport though ;-)
@cjw296 cjw296 merged commit adbf178 into python:master May 1, 2019
@cjw296
Copy link
Contributor Author

cjw296 commented May 1, 2019

@mariocj89 / @tirkarthi - I'm unsure about whether this should be backported to the 3.7 branch:

  • on the one hand, there's not "bugfix" code here, so it should be fine to not backport.
  • on the other, without being backported, it may be more difficult to backport future bugfixes.
  • the pypi.py mock package is hopefully going to be released "real soon now"

Thoughts?

@ZackerySpytz
Copy link
Contributor

FWIW, I believe a BPO issue should have been created for this sizeable patch (as prescribed by the developer's guide).

@cjw296
Copy link
Contributor Author

cjw296 commented May 1, 2019

My apologies, would you like me to retrospectively open one?

@tirkarthi
Copy link
Member

Please don't backport this to 3.7 . I feel this could have waited a bit since some of the internals of mock don't have tests and one refactoring that seemed harmless had produced regression (https://bugs.python.org/issue36593). I agree with Zackery that this could have had a bpo and possibly a review from @voidspace but it's little late since this is merged. But then we have beta period for bug fixing if any and can revert chunks of it if needed :)

@cjw296
Copy link
Contributor Author

cjw296 commented May 2, 2019

Well, actually, as of this PR, the internals of mock do have tests. Everything is covered, some of it was challenging ;-)

My intention was to get his into the backport so we could get some real world experience of it.
Interestingly, that has stalled on a weird and annoying failure on pypy:
https://travis-ci.org/testing-cabal/mock/jobs/527082522#L455

This is super weird, the first call to mock.__sizeof__ fails, but subsequent ones succeed. Any ideas on that very gratefully received.

@voidspace / @mfoord is at PyCon and said he'd have time to sprint on Mock, so hopefully he can give this a good going over. I've got the backporting process to the standalone mock package working again, so whatever we find we can get quickly released onto pypi for more testing.

@tirkarthi
Copy link
Member

This is super weird, the first call to mock.sizeof fails, but subsequent ones succeed. Any ideas on that very gratefully received.

Are you seeing this after the PR or before the PR itself? Please add the code and error. I could give it a try.

@cjw296
Copy link
Contributor Author

cjw296 commented May 2, 2019

@cjw296
Copy link
Contributor Author

cjw296 commented May 2, 2019

Oh. and here's the "fix": testing-cabal/mock@252c749

Now, why would pypy need that for magic mocks to work?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants