GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-149640: Add new GitHub action to test lazy_imports=all against test suite by brittanyrey · Pull Request #151105 · python/cpython

Conversation

@brittanyrey

@brittanyrey brittanyrey commented Jun 8, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This commit adds a new action to run the CPython test suite with lazy_imports=all set as suggested in this comment.

#149640

  • Issue: Should we test -X lazy_imports=all more? #149640

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot mentioned this pull request Jun 8, 2026
Should we test -X lazy_imports=all more? #149640
Closed
StanFromIreland
StanFromIreland reviewed Jun 8, 2026
View reviewed changes
Comment thread .github/workflows/lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@brittanyrey brittanyrey mentioned this pull request Jun 8, 2026
gh-149640: Add new GitHub action to test lazy_imports=all against test suite #151090
Closed
@brittanyrey

brittanyrey commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the early review @StanFromIreland !

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brittanyrey
brittanyrey force-pushed the lazy-imports-all-ci branch from 082f3f1 to 4dab14b Compare June 9, 2026 18:01
@brittanyrey
brittanyrey marked this pull request as ready for review June 9, 2026 19:03
@brittanyrey
brittanyrey requested review from AA-Turner, FFY00, brettcannon, ericsnowcurrently, ezio-melotti, hugovk, itamaro, ncoghlan, warsaw and webknjaz as code owners June 9, 2026 19:03
@bedevere-app bedevere-app Bot added the awaiting review label Jun 9, 2026
@StanFromIreland StanFromIreland added skip news infra CI, GitHub Actions, buildbots, Dependabot, etc. labels Jun 9, 2026
@brittanyrey

brittanyrey commented Jun 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

I'm not seeing my new test in checks, but it does show up as a failure in "All required checks pass". Not sure how to dig in from here.

Edit: Fixed!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland
StanFromIreland reviewed Jun 9, 2026
View reviewed changes
Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@brettcannon
brettcannon removed their request for review June 10, 2026 19:59
hugovk
hugovk reviewed Jun 10, 2026
View reviewed changes

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

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.

Thanks for this, looks good! I like the incremental method of tightening what is allowed to fail.


This workflow ensures that tests which currently work with lazy imports continue to work. If they regress, we get a failure, and need to fix it. This is good.

When we fix one of the excluded tests, we remove it from the list. Then is won't regress in the future. Also good!

What about if we "accidentally" fix an excluded test? We won't know it's been fixed, until someone checks, and then removes from the exclusion list.

Can we improve this? So for an "accidental" fix, the test also fails, but in a good way -- it tells you to also remove it from te exclude list, to prevent future regressions.


We have something similar for incrementally fixing Sphinx reference errors and tightening the allowed fails as we go: see https://github.com/python/cpython/blob/main/Doc/tools/.nitignore for the exclusion list, and https://github.com/python/cpython/blob/main/Doc/tools/check-warnings.py for the code that will fail_if_regression(), fail_if_new_news_nit() but also fail_if_improved().

Do you think something along these lines is worth it for lazy imports?

(Bonus points if we can think of a good .gitgnore/.nitignore pun for lazy_imports_all_exclude.txt, but not required :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

brittanyrey reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread .github/workflows/build.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@brittanyrey

brittanyrey commented Jun 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@hugovk I added the check to make sure the excluded list of tests still fail.

Oddly, a lot of the ones that were failing locally for me & failing in the original issue stopped failing on CI? This was a bit surprising/confusing? cc: @JelleZijlstra

Edit: It was a bug, addressing in commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland
StanFromIreland reviewed Jun 11, 2026
View reviewed changes
Comment thread Lib/test/lazy_imports_all_exclude.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/lazy_imports_all_exclude.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@brittanyrey
brittanyrey requested review from StanFromIreland and hugovk June 11, 2026 18:39
@JelleZijlstra

JelleZijlstra commented Jun 11, 2026

Copy link
Copy Markdown
Member

A few thoughts:

  • Is this important enough to warrant adding a new GH Action? Should it be a buildbot instead?
  • It's possible some of the failing modules in my issue were due to unrelated problems in my environment; I don't often run the full test suite locally.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JelleZijlstra

JelleZijlstra commented Jun 11, 2026

Copy link
Copy Markdown
Member

Also we need to add some mechanism (decorator?) to mark tests as expected to fail under lazy imports = all. My issue mentioned a few scenarios, like a test relying on the import side effect of creating a pyc file.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brittanyrey

brittanyrey commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Also we need to add some mechanism (decorator?) to mark tests as expected to fail under lazy imports = all. My issue mentioned a few scenarios, like a test relying on the import side effect of creating a pyc file.

We could use unittest.skipIf to check if lazy imports all is set.

JelleZijlstra reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

brittanyrey added 8 commits August 17, 2026 18:49
@brittanyrey
Take a swing at adding exclusion checks
860f80d
@brittanyrey
remove allegedly passing modules?
e1c07b6
@brittanyrey
clean up
77d1dcf
@brittanyrey
Fix bug with env var not flowing through and bring back exclusions
1dbdf0b
@brittanyrey
Accidentally added random files
e577926
@brittanyrey
Add more modules
47fb4a4
@brittanyrey
Address incorrect exclusions
651cb43
@brittanyrey
Address feedback: update ubuntu version and CODEOWNERS file
5540969
@brittanyrey
brittanyrey force-pushed the lazy-imports-all-ci branch from 92ff8cc to 5540969 Compare August 18, 2026 02:08
@brittanyrey
Prune test_idle and test_zoneinfo from the exclusion list
d41581f
@brittanyrey

brittanyrey commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Addressed comments! Thanks for the review @StanFromIreland

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland
StanFromIreland reviewed Aug 18, 2026
View reviewed changes
Comment thread .github/workflows/build.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .github/workflows/reusable-test-lazy-imports-all.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@brittanyrey
Address comments. Variety of small nits and cleanups.
8f7988d
@brittanyrey

brittanyrey commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks again @StanFromIreland. Let me know if there's anything else that needs updating.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland
StanFromIreland reviewed Aug 19, 2026
View reviewed changes
Comment thread 4 Resolved

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland
StanFromIreland reviewed Aug 19, 2026
View reviewed changes
Comment thread .github/CODEOWNERS Resolved

Uh oh!

There was an error while loading. Please reload this page.

brittanyrey added 2 commits August 19, 2026 13:02
@brittanyrey
Remove accidental file and remove myself from codeowners :(
e54a674
@brittanyrey
Deleting other random empty files
341b3d7
@brittanyrey

brittanyrey commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Alright, I think we're good! @StanFromIreland

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland
StanFromIreland approved these changes Aug 19, 2026
View reviewed changes

@StanFromIreland StanFromIreland left a comment

Copy link
Copy Markdown
Member

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 seems reasonable to me, at least till the list is empty, and we can debate again then.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

brittanyrey reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Aug 19, 2026
brittanyrey added 2 commits August 19, 2026 14:14
@brittanyrey
Minor change to trigger tests again
299a6ee
@brittanyrey
Minor change to trigger tests again 2
9ba8ca2
@ashm-dev ashm-dev mentioned this pull request Aug 29, 2026
test.support.warnings_helper.check_warnings() raises KeyError: 'warnings' under -X lazy_imports=all #156570
Open
pablogsal
pablogsal approved these changes Sep 18, 2026
View reviewed changes

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

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.

Looks good, thanks @brittanyrey! 🚀

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

brittanyrey reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@pablogsal
pablogsal merged commit b62e028 into python:main Sep 18, 2026
53 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Sep 18, 2026
@brittanyrey
brittanyrey deleted the lazy-imports-all-ci branch September 18, 2026 21:16
@pablogsal pablogsal mentioned this pull request Oct 9, 2026
Request for Python triage membership: Brittany Reynoso python/core-workflow#609
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes
@StanFromIreland StanFromIreland StanFromIreland approved these changes
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently
@ncoghlan ncoghlan Awaiting requested review from ncoghlan
@warsaw warsaw Awaiting requested review from warsaw
@FFY00 FFY00 Awaiting requested review from FFY00
@ezio-melotti ezio-melotti Awaiting requested review from ezio-melotti ezio-melotti is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@webknjaz webknjaz Awaiting requested review from webknjaz webknjaz is a code owner
@itamaro itamaro Awaiting requested review from itamaro itamaro is a code owner
@hugovk hugovk Awaiting requested review from hugovk hugovk is a code owner
@JacobCoffee JacobCoffee Awaiting requested review from JacobCoffee JacobCoffee is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

infra CI, GitHub Actions, buildbots, Dependabot, etc. skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@brittanyrey @JelleZijlstra @StanFromIreland @hugovk @pablogsal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.