TST, MAINT: Replace most setup with setup_method (also teardown) #22487
TST, MAINT: Replace most setup with setup_method (also teardown) #22487charris merged 5 commits intonumpy:mainfrom
Conversation
Not actually sure that setup_module() is what was wanted here, but it works? Mention a bit more about actual pytest fixtures.
In some cases, the replacement is clearly not what is intended, in those (where setup was called explicitly), I mostly renamed `setup` to `_setup`. The `test_ccompile_opt` is a bit confusing, so left it right now (this will probably fail)
| len(m1) - reduce(lambda x, y:x + y, m1)) | ||
| assert_(eq(xm, xf)) | ||
| assert_(eq(filled(xm, 1.e20), xf)) | ||
| assert_(eq(x, xm)) |
There was a problem hiding this comment.
The old code called the setup manually between loop iterations, so just refactored this to a fixture.
| self._setup() | ||
|
|
||
| def setup(self): | ||
| def _setup(self): |
There was a problem hiding this comment.
Since the init calls it explicitly, this seemed right. There is only one test, so it doesn't matter anyway, but I suspect the intention isn't to rerun it on each test method.
There was a problem hiding this comment.
And hopefully we can remove distutils in a few years :)
|
|
||
| def teardown(self): | ||
| def teardown_method(self): | ||
| np.seterr(**self.olderr) |
There was a problem hiding this comment.
Admittedly, these might be nicer as @np.errstate(invalid="ignore") decorators.
|
Seems to be working, so considering it done. I did not review the replacements very carefully, so we could do that. But I think they should be safe and seem mostly right (even if often there are probably better ways to do things.) |
|
The Cygwin failure looks unrelated, I suspect the chocolatey v1.2.0 release on Oct 19. @DWesl Thoughts? |
|
That seems to have flipped between 21 hours ago and seven hours ago; I'm not sure how much delay there is in propagating chocolatey updates to mirrors. I could try switching to cygwin/cygwin-install-action@v2 rather than egor-tensin/setup-cygwin@v3, which should at least produce a different error. |
|
@DWesl the log explicitly mentions chocolatey v1.2.0, but it is still a guess on my part that is the cause. But it looks suspicious. |
|
LGTM modulo a couple of easy lint fixes. |
|
And twenty-one hours ago, the CI job was using 1.1.0, so that looks like the problem. #22488 changes from using chocolatey to setup-x86_64.exe |
Not new things, but in touched lines...
|
Thanks Sebastian. |
In some cases, the replacement is clearly not what is intended,
in those (where setup was called explicitly), I mostly renamed
setupto_setup.The
test_ccompile_optis a bit confusing, so left it right now(this will probably fail)
Also changed the docs a little bit. (Draft, just because I expect one failure still.)
Closes gh-22486