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

gh-127146: Update test skips for Emscripten 4.0.2 #129474

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hoodmane
Copy link
Contributor

@hoodmane hoodmane commented Jan 30, 2025

Emscripten 4.0.2 brought in a few new file system bug fixes.

@bedevere-app bedevere-app bot added awaiting review tests Tests in the Lib/test dir labels Jan 30, 2025
@hoodmane hoodmane removed the request for review from brettcannon January 30, 2025 12:55
Copy link
Contributor

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Looks fairly straightforward; a couple of small suggestions/questions inline.

@@ -502,6 +499,8 @@ class UnseekableWriter(self.MockUnseekableIO):
(self.BytesIO, "rws"), (self.StringIO, "rws"),
)
for [test, abilities] in tests:
if test == pipe_writer and not threading_helper.can_start_thread:
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this use skipTest rather than continue?

Copy link
Contributor Author

@hoodmane hoodmane Jan 31, 2025

Choose a reason for hiding this comment

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

If we wanted to do that we'd have to split the with statement below like:

            with self.subTest(test):
                if cond:
                   skipTest()
                with test() as obj:
                     ...

and then we'd have to indent the whole body. I think it's better to use continue than to have to indent a bunch of stuff another level.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree that it requires some code churn (and some deeper-than-ideal nesting).

My motivation here is to make sure that we have visibility on the skip - with a continue, there's no tracking that the test wasn't executed. If the code ever skips for the wrong reason, or you need to audit to see what isn't being tested, there's no visibility on that.

How about a third option: Pull out the current test logic as a _subtest() utility method that takes test as an argument. That way, the indent level for the body of the test stays the same; the only code churn is to move the for loop to after the subtest utility method. However, that for loop becomes a much clearer "run this subtest for each configuration" loop, with clear "run or skip" logic for each case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this makes sense to me I'll try it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though if we're skipping because of threading I guess the only question is whether the feature in question could be tested without threading. Other than that there's nothing here to fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed that's another way to fix this... but I don't see an obvious way to implement the pipe writer test without threading (at least, not without leaving the test prone to blocking). I'm open to suggestions, though.

Lib/test/test_io.py Outdated Show resolved Hide resolved
Lib/test/test_io.py Outdated Show resolved Hide resolved
@bedevere-app
Copy link

bedevere-app bot commented Jan 30, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants