-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Make .test parser friendlier #15385
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
Make .test parser friendlier #15385
Conversation
cbf5f72
to
5e2c7eb
Compare
@@ -367,12 +360,13 @@ def setup(self) -> None: | |||
self.steps = [steps.get(num, []) for num in range(2, max_step + 1)] | |||
|
|||
def teardown(self) -> None: | |||
assert self.old_cwd is not None and self.tmpdir is not None, "test was not properly set up" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would trip up whenever setup failed, adding to the noise (and making the setup failure, which is the underlying cause, harder to find)
r"^\[case ([a-zA-Z_0-9]+)" | ||
r"(-writescache)?" | ||
r"(-only_when_cache|-only_when_nocache)?" | ||
r"(-posix|-windows)?" | ||
r"(-skip)?" | ||
r"(-xfail)?" | ||
r"\][ \t]*$\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, when [case foo-bar-baz]
didn't comply with this pattern, we'd simply skip it and it would end up merging into the section of the preceding [case]
.
ac15b53
to
48eb214
Compare
48eb214
to
b39cd0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
It seems as though this PR again broke the mypy wheel build. Maybe a similar issue to the one fixed in #15383? |
Quality of life improvements:
pytest.fail(..., pytrace=False)
to eliminate stack trace noise.TestItem.line
which is relative to testcase (e.g. for main item of testcase starting at line 1234, it'll be 1).case
sections, erroring out on invalid names; previously invalid [case]s were ignored duringsplit_test_cases
but then resurfaced when parsing (as they'd end up being a section of the preceding case):I've added some rudimentary tests for this, also moving the
--update-data
test along intomypy/tests/meta
. Since those are "meta tests", we shouldn't make them comprehensive, only trying to keep up some basic level of contributor ergonomics.