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-114099: Add test exclusions to support running the test suite on iOS #114889

Merged
merged 6 commits into from Feb 5, 2024

Conversation

freakboy3742
Copy link
Contributor

@freakboy3742 freakboy3742 commented Feb 2, 2024

Part of the PEP 730 work to add iOS support.

Adds test annotations required to run the CPython test suite on iOS.

The majority of these changes involve:

  • Annotating tests that use subprocess, but are skipped on Emscripten/WASI for other reasons
  • Including iOS/tvOS/watchOS under the same umbrella as macOS/darwin checks

is_apple and is_apple_mobile test helpers have been added to identify any Apple platform, and "any Apple platform except macOS", respectively.

Refs #114099.

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me!

Lib/test/support/__init__.py Outdated Show resolved Hide resolved
Lib/test/support/__init__.py Outdated Show resolved Hide resolved
Lib/test/test_asyncio/test_events.py Outdated Show resolved Hide resolved
Lib/test/test_asyncio/test_unix_events.py Outdated Show resolved Hide resolved
Lib/test/test_pty.py Outdated Show resolved Hide resolved
Lib/test/test_venv.py Outdated Show resolved Hide resolved
@mhsmith
Copy link
Member

mhsmith commented Feb 4, 2024

I'm not a project member, so I can't resolve my conversations, but they've all now been addressed.

Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

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

Looks good. Ran without issue on Sonoma 14.2.1. One small question/nit re: an import.
🚢

@@ -1874,7 +1874,7 @@ async def runner():
wsock.close()


@unittest.skipUnless(hasattr(os, 'fork'), 'requires os.fork()')
@support.requires_fork()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Much cleaner.

@@ -160,6 +161,7 @@ def setUp(self):
self.console = code.InteractiveConsole(local_exit=True)
self.mock_sys()

@unittest.skipIf(sys.flags.no_site, "exit() isn't defined unless there's a site module")
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work if the import site does not exist in the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does - the import site was a leftover from a previous attempt to fix the problem that was ultimately resolved with the no_site-based skip. I've removed the import.

@erlend-aasland erlend-aasland self-assigned this Feb 4, 2024
@erlend-aasland
Copy link
Contributor

Are you ready to land this, @freakboy3742?

@freakboy3742
Copy link
Contributor Author

@erlend-aasland I'm ready if everyone else is :-)

@erlend-aasland
Copy link
Contributor

AFAICS, @willingc's remarks have been addressed; the rest are thumbs up. Let's go :)

@erlend-aasland erlend-aasland merged commit 391659b into python:main Feb 5, 2024
31 checks passed
@freakboy3742 freakboy3742 deleted the iOS-test-skips branch February 5, 2024 00:16
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…e on iOS (python#114889)

Add test annotations required to run the test suite on iOS (PEP 730).

The majority of the change involve annotating tests that use subprocess,
but are skipped on Emscripten/WASI for other reasons, and including
iOS/tvOS/watchOS under the same umbrella as macOS/darwin checks.

`is_apple` and `is_apple_mobile` test helpers have been added to
identify *any* Apple platform, and "any Apple platform except macOS",
respectively.
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
…e on iOS (python#114889)

Add test annotations required to run the test suite on iOS (PEP 730).

The majority of the change involve annotating tests that use subprocess,
but are skipped on Emscripten/WASI for other reasons, and including
iOS/tvOS/watchOS under the same umbrella as macOS/darwin checks.

`is_apple` and `is_apple_mobile` test helpers have been added to
identify *any* Apple platform, and "any Apple platform except macOS",
respectively.
Comment on lines +9 to +11
from test.support import (
cpython_only, get_pagesize, is_apple, requires_subprocess, verbose
)
Copy link
Member

Choose a reason for hiding this comment

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

You seem to do this change often. In the future, could you add a trailing comma, to make future diffs nicer?
(Or simply add another line if the current one gets too long:

from test.support import verbose, cpython_only, get_pagesize
from test.support import is_apple, requires_subprocess

)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@encukou Sure, no problem.

One of the issues I've hit is that the "preferred" style for imports varies wildly between files. I appreciate there's 30 years of historical baggage in the existing code - but is there a reason either of those two approaches is preferred over isort/black style syntax:

from test.support import (
    cpython_only, 
    get_pagesize, 
    is_apple, 
    requires_subprocess, 
    verbose,
)

Running black over every file I touch would make for unreadable patches; but if little black touches when the line is already being altered would be looked on favourably, then that's an easy tweak to make.

Copy link
Member

Choose a reason for hiding this comment

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

That works too -- there's a trailing comma, so future diffs won't need to add it.

(The 30 years of baggage also means there is no shared preference for stuff that isn't in PEP 8. I'm partial to repeating from <name> because it's searchable with grep -- you don't need a code analyzer -- but that's just personal opinion.)

if little black touches when the line is already being altered would be looked on favourably

Sure! As long as it helps readability :)

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

Successfully merging this pull request may close these issues.

None yet

5 participants