Skip to content

CI: [diagnostic, do not merge] Test python -m pytest vs pytest.exe launcher - #708

Closed
echoix wants to merge 1 commit into
mainfrom
ci-diag/python-m-pytest-vs-exe
Closed

echoix wants to merge 1 commit into
mainfrom
ci-diag/python-m-pytest-vs-exe

Conversation

@echoix

@echoix echoix commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Purpose

Seventh diagnostic in this investigation. Ruled out so far:

  • Every dumpbin export/import diff of the changed OSGeo4W packages and
    grass_gis.8.6.dll's own dependency chain -- all clean.
  • MSYS2 mingw-w64 toolchain downgrade -- still crashes.
  • A single, isolated from grass.pygrass import utils import -- no
    crash.
  • Sequentially importing all 22 grass.lib.* submodules in one process
    -- no crash (rules out raw DLL-count/TLS-slot exhaustion).
  • Plain single-process pytest ... with no xdist/-n flag at all --
    still crashes with the same
    Windows fatal exception: code 0xc0000139 (see
    ci-diag/no-xdist-single-process), ruling out pytest-xdist/execnet's
    threading model.

So the crash isn't about parallelism, symbol tables, or DLL count --
it's specifically tied to pytest's own test collection somehow. One
concrete, testable difference remains: the crashing runs invoke
pytest ... directly, which resolves to the compiled
Scripts\pytest.exe launcher stub
(Scripts\pytest.exe\__main__.py appears in the crash traceback),
whereas the passing standalone tests ran via python -c ... /
python <script>.py directly.

What this PR does

Runs the same two known-failing test files
(test_i_gensig.py, lib/arraystats/tests) through
python -m pytest instead of bare pytest, which executes pytest's
code inside the already-running python.exe process with no separate
launcher-stub executable, to see if that alone avoids the crash.

This PR is for CI investigation only and is not meant to be merged.

🤖 Generated with Claude Code

…rge)

Bare `pytest ...` (invoking the compiled Scripts\pytest.exe launcher
stub) crashes with "Windows fatal exception: code 0xc0000139"
collecting the known-failing test files even WITHOUT xdist (confirmed
in the sibling ci-diag/no-xdist-single-process PR), ruling out
pytest-xdist/execnet's threading model as the cause. A plain
`python -c "from grass.pygrass import utils"` and a sequential import
of every grass.lib.* submodule both succeed in a single process (see
the other sibling diagnostic PRs), and every dumpbin export/import
diff of grass_gis.8.6.dll's dependency chain came back clean.

The one concrete difference left between the crashing and
non-crashing cases: pytest was invoked via the pytest.exe launcher
stub (Scripts\pytest.exe\__main__.py), not python.exe directly. This
tests the same collection through `python -m pytest` instead, which
runs inside the already-running python.exe process with no separate
launcher stub, to see if that alone avoids the crash.

Temporary, for CI investigation only.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@echoix echoix closed this Oct 1, 2026
@echoix
echoix deleted the ci-diag/python-m-pytest-vs-exe branch October 1, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant