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

MNT: Do not completely take over test collection ignore #201

Merged
merged 4 commits into from
Jun 7, 2023

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Jun 7, 2023

Main motivation is to fix compatibility with pytest 7.4.0.dev though theoretically this plugin should not completely take over the ignore part of test collection? See pytest-dev/pytest#11082 (comment) for more details. Affected issue:

I am adding a test first to make sure it fails in pytest-dev before trying out the patch. I am also using pytester instead of testdir, see #200 .

@pllim pllim added the bug label Jun 7, 2023
@pllim
Copy link
Contributor Author

pllim commented Jun 7, 2023

Indeed the test added here threw error with pytest-dev without any patch:

E     File ".../test_norecursedirs0/bad_dir/test_foobar.py", line 2
E       def f():
E   IndentationError: unexpected indent

With the patch, error is gone.

to ensure compatibility with pytest 7.4
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

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

extreme nitpick, otherwise looks good.

CHANGES.rst Outdated
@@ -1,6 +1,8 @@
0.12.2 (unreleased)
===================

- Compatibility with pytest 7.4 w.r.t. norecursedirs handling. [#201]
Copy link
Member

Choose a reason for hiding this comment

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

Spell it out pls :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, done! 😸

@bsipocz bsipocz added this to the 0.12.2 milestone Jun 7, 2023
@bsipocz
Copy link
Member

bsipocz commented Jun 7, 2023

Unrelated, but I suppose we should maybe test all OSes with pytest-dev? The full CI matrix is done in 4minutes, so it wouldn't add much additional burden.

@bsipocz bsipocz merged commit 02649fd into scientific-python:main Jun 7, 2023
@bsipocz
Copy link
Member

bsipocz commented Jun 7, 2023

Thx 😉 !

@pllim pllim deleted the fix-ignore-collect branch June 7, 2023 22:56
@pllim
Copy link
Contributor Author

pllim commented Jun 8, 2023

test all OSes with pytest-dev?

But what value does that add? We don't do that with other packages right now, and hopefully pytest itself would test across different platforms. Does not hurt but I also don't see a real need, so up to you.

@bsipocz
Copy link
Member

bsipocz commented Jun 8, 2023

I would just like to have a more comprehensive test suite (I do recall where we indeed do an equal matrix on the 3 OSes), at worst, we waste ~5min of CI time once a week. We do walk through all the old versions already, but not that pedantic with newer versions, e.g. all are missing between 7.0 and dev.

@pllim
Copy link
Contributor Author

pllim commented Jun 8, 2023

Actually, maybe that is a very good idea especially since doctest deals with paths a lot and Windows is always so special. But perhaps cron instead of per commit? I opened #202 about this. Thanks!

@bsipocz
Copy link
Member

bsipocz commented Jun 8, 2023

ATM I prefer the per-commit option (and run all from cron), at least until the notifications are fixed for cron jobs.

@bsipocz bsipocz modified the milestones: 0.12.2, 0.13 Jun 8, 2023
@@ -554,7 +554,7 @@ def get_list_opt(name):
self._ignore_paths.append(path)
break

return False
# None = Let other plugins decide the outcome.

Choose a reason for hiding this comment

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

FWIW, I'd use an explicit return None here - from PEP8:

Be consistent in return statements. Either all return statements in a function should return an expression, or none of them should. If any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None, and an explicit return statement should be present at the end of the function (if reachable)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @The-Compiler ! I have done that in 7b605ef directly in main since we're about to move the repo and I don't want extra overhead for a trivial change.

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

Successfully merging this pull request may close these issues.

3 participants