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 — JIT: test_unittest fails with -X lazy_imports=all: unittest.main is a module · Issue #158086 · python/cpython

JIT: test_unittest fails with -X lazy_imports=all: unittest.main is a module #158086

New issue
Copy link
New issue
Copy link
Open
#158087
Open
JIT: test_unittest fails with -X lazy_imports=all: unittest.main is a module#158086
#158087
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-lazy-importstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@ashm-dev
ashm-dev
opened on Sep 24, 2026
Issue body actions

Bug report

Bug description:

Six tests in test_unittest.test_program fail when the test suite is run with -X lazy_imports=all:

./python -X lazy_imports=all -m test test_unittest
ERROR: test_Exit (test.test_unittest.test_program.Test_TestProgram.test_Exit)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_unittest/test_program.py", line 150, in test_Exit
    unittest.main(
    ~~~~~~~~~~~~~^
        argv=["foobar"],
        ...
TypeError: 'module' object is not callable

The same error occurs in test_ExitAsDefault, test_ExitEmptySuite, test_ExitSetUpClassFailureSuite, test_ExitSkippedSuite and test_NonExit.

unittest.main resolves to the unittest.main submodule instead of the unittest.main.TestProgram class.

Without -X lazy_imports=all the tests pass.

Build configuration:

CC=clang-21 CXX=clang++-21 LDFLAGS='-fuse-ld=lld-21' ./configure --enable-experimental-jit=yes

CPython versions tested on:

CPython main branch, 3.16

Operating systems tested on:

Linux

Linked PRs

  • gh-158086: Fix unittest.main shadowed by its submodule under lazy imports #158087

Activity

  1. ashm-dev
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Sep 24, 2026
  2. ashm-dev
    changed the title [-]Title: test_unittest fails with -X lazy_imports=all: unittest.main is a module[/-] [+]JIT: test_unittest fails with -X lazy_imports=all: unittest.main is a module[/+] on Sep 24, 2026
  3. hugovk
    added
    topic-lazy-imports
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Sep 24, 2026
  4. kevinprimeraquecreo-stack
    added this to Project_VKon Oct 18, 2026
  5. github-project-automation
    moved this to Todo in Project_VKon Oct 18, 2026
  6. github-project-automation
    moved this from Todo to In progress in Project_VKon Oct 18, 2026
  7. kevinprimeraquecreo-stack
    added this to Project_VKon Oct 18, 2026
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-lazy-importstype-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.