Repository navigation
fix: keep the working directory after gopy pkg & gopy exe - #416
Merged
Merged
Conversation
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.
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.
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.
- 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
force-pushed
the
split/2-fix-exe-pkg
branch
from
November 5, 2026 02:36
6a08e53 to
2a2884e
Compare
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
b-long
added a commit
that referenced
this pull request
Nov 7, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes: #414