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 — fix: keep the working directory after `gopy pkg` & `gopy exe` by b-long · Pull Request #416 · go-python/gopy

Conversation

@b-long

@b-long b-long commented Nov 5, 2026

Copy link
Copy Markdown
Member
  • ci: harden the main test job
  • test: run gopy as a subprocess, so tests can run in parallel
  • fix: build the executable gopy exe is asked for
  • fix: restore the working directory after gopy pkg and exe

Closes: #414

Sorry, something went wrong.

Uh oh!

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

All reactions
b-long added 4 commits November 4, 2026 21:32
@b-long
fix: restore the working directory after gopy pkg and exe
942f37a
GenPyPkgSetup chdirs into the output directory, and neither command
changed back, so a caller running gopy in-process (as main_test.go does)
was left in the output directory, or in no directory at all once that
was removed: every later build then failed with

    getwd: no such file or directory

TestPkg builds _examples/simple with gopy pkg and runs its test.py.
@b-long
fix: build the executable gopy exe is asked for
cf887e3
gopy exe printed `go build -o py<pkg>` but ran `go build -mod=mod` alone:
the -o and -tags it appended went to an unused slice, so the executable
was named after the directory and built without the requested tags.  It
now runs the command it prints, adding Windows' .exe suffix.

The build that only writes <pkg>_go.h for the second build.py run was a
c-shared link of a .c file compiled against the placeholder header, which
macOS and Windows refuse when it calls functions (such as the static
_gopy_clear_go_tls) it can't link to yet.  It is now a c-archive, which
writes the header without linking, both in gopy exe and in the Makefile
it generates.

The BuildMode constants other than ModeGen were untyped strings; they
are now typed, and runBuild is passed bind.ModeBuild.

TestExe checks that gopy exe writes setup.py and the executable.
@b-long
test: run gopy as a subprocess, so tests can run in parallel
669d9c9
The generator keeps its state in package variables and gopy changes the
process's working directory, so main_test.go ran every gopy command
in-process and in sequence.  TestMain now builds the gopy binary once and
the tests run it as a separate process, which lets them call t.Parallel().

`make cover` collects coverage from those gopy processes too: the test
binaries and gopy write raw coverage data to covdata/, which is merged
into coverage.out.  codecov.yml counts Go's "partial" lines as hits, as
`go tool cover` does.

Also ignore Python bytecode caches, and remove the one that was committed
under _examples/funcs.
@b-long
ci: harden the main test job
2a2884e
- Pin goimports to v0.29.0 instead of @latest, so the tool TestGofmt
  checks against doesn't change from one run to the next.
- Drop the apt-get step: none of the packages it installed are used.
- Disable Windows Defender real-time scanning, which slows every
  compile, link and pip install on windows-latest.
- Give the job a 20-minute timeout, rather than GitHub's 6h default.
- Cancel a pull request's previous run when it is pushed to again, and
  let the matrix fail fast.
@b-long
b-long force-pushed the split/2-fix-exe-pkg branch from 6a08e53 to 2a2884e Compare November 5, 2026 02:36
@codecov

codecov Bot commented Nov 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.61%. Comparing base (d81ecee) to head (2a2884e).

Files with missing lines Patch % Lines
cmd_build.go 91.66% 1 Missing ⚠️
cmd_exe.go 75.00% 1 Missing ⚠️
cmd_pkg.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #416       +/-   ##
===========================================
+ Coverage   74.79%   85.61%   +10.82%     
===========================================
  Files          25       24        -1     
  Lines        4658     4568       -90     
===========================================
+ Hits         3484     3911      +427     
+ Misses        934      657      -277     
+ Partials      240        0      -240     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

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

@b-long
b-long merged commit af0b230 into master Nov 5, 2026
26 checks passed

Uh oh!

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

@github-actions github-actions Bot mentioned this pull request Nov 5, 2026
chore(master): release 0.5.3 #418
Merged
b-long added a commit that referenced this pull request Nov 7, 2026
@b-long
test: run TestComplexGILStress's gopy as a subprocess, in parallel
60b0feb
Master's main_test.go now builds the gopy binary once in TestMain and has
tests run it through runGopy, so they can call t.Parallel() (#416). Running
gopy in-process is unsafe there, because the generator keeps its state in
package variables. Move TestComplexGILStress to runGopy and t.Parallel(),
like TestGilString, and drop its bind.ResetPackages(), which only cleaned
up the in-process run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

The gopy pkg and gopy exe commands change (and do not restore) the working directory

Uh oh!

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

1 participant

@b-long
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.