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 — We don't run `test_lazy_imports` · Issue #145334 · python/cpython

We don't run test_lazy_imports #145334

New issue
Copy link
New issue
Copy link
Closed
Closed
We don't run test_lazy_imports#145334
Copy link
Labels
3.15bugs and security fixesbugs and security fixesinfraCI, GitHub Actions, buildbots, Dependabot, etc.CI, GitHub Actions, buildbots, Dependabot, etc.testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@johnslavik
johnslavik
opened on Feb 27, 2026
Issue body actions

Bug report

Bug description:

This is Lib.test.test_import:

Lib/test/test_import
├── __init__.py
├── __main__.py
├── data
└── test_lazy_imports.py

Our test finder doesn't see test_lazy_imports: #144852 (comment).

python -m test does not run test_lazy_imports at all.

We could try to keep regular import test package with lazy import test package by:

  1. Updating Lib.test.libregrtest.findtests.SPLITTESTDIRS to include test_import.
  2. Moving Lib/test/test_import/__init__.py to Lib/test/test_import/test_import.py .
  3. Creating a new Lib/test/test_import/__init__.py that defines load_tests hook that calls load_package_tests.

It is visible by now that this is a can of worms. Lib.test.test_import uses relative imports itself, so moving Lib.test.test_import to Lib.test.test_import.test_import breaks them. This means we'd need to massage Lib.test.test_import.test_import to work again, which means we'd need to modify old tests -- which I think on its own disqualifies this approach.

We can't have Lib.test.test_import and Lib.test.test_import.test_lazy_imports at the same time set up in a maintainable way, because it would involve having manual registration of test suites in test_import (or maybe in test_lazy_imports?). Perhaps we can do this cheaply, but I assume this makes these tests less self-contained and complicates the setup.

I propose we move Lib/test/test_import/test_lazy_imports.py (+data) into Lib/test/test_lazy_import/__init__.py (+data). Unless there is any other cost-effective solution to this that I've missed?

CC @pablogsal @DinoV @brittanyrey @Yhg1s @vstinner @sobolevn

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

  • gh-145334: Make lazy import tests discoverable #145336
Reacted by Pablo Galindo Salgado, Chris Eibl and Maurycy Pawłowski-Wieroński

Activity

  1. johnslavik
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    testsTests in the Lib/test dirTests in the Lib/test dir
    infraCI, GitHub Actions, buildbots, Dependabot, etc.CI, GitHub Actions, buildbots, Dependabot, etc.
    on Feb 27, 2026
  2. johnslavik
    changed the title [-]We're not `test_lazy_imports` in CI[/-] [+]We're not running `test_lazy_imports` in CI[/+] on Feb 27, 2026
  3. johnslavik
    changed the title [-]We're not running `test_lazy_imports` in CI[/-] [+]We don't run `test_lazy_imports` in CI[/+] on Feb 27, 2026
  4. johnslavik
    changed the title [-]We don't run `test_lazy_imports` in CI[/-] [+]We don't run `test_lazy_imports`[/+] on Feb 28, 2026
  5. johnslavik
    added
    3.15bugs and security fixesbugs and security fixes
    on Feb 28, 2026
  6. pablogsal commented on Feb 28, 2026

    @pablogsal
    pablogsal
    on Feb 28, 2026
    Member
    More actions

    Oh wow, good catch! Excellent job!

    Reacted by Chris Eibl
    Reacted by Bartosz Sławecki
  7. pablogsal
    added a commit that references this issue on Feb 28, 2026

    gh-145334: Make lazy import tests discoverable (#145336)

    a66d518
  8. pablogsal
    closed this as completedon Feb 28, 2026
  9. brijkapadia
    added a commit that references this issue on Feb 28, 2026

    pythongh-145334: Make lazy import tests discoverable (python#145336)

    2958b3c
  10. johnslavik
    added a parent issue on Apr 14, 2026
    • Implement PEP 810 – Explicit lazy imports #142349
  11. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythongh-145334: Make lazy import tests discoverable (python#145336)

    4b41b9a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixesbugs and security fixesinfraCI, GitHub Actions, buildbots, Dependabot, etc.CI, GitHub Actions, buildbots, Dependabot, etc.testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.