← Winnitude! Search  ·  Reader Mode (2346 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 97 LINKS

added examples and py utils by drew-512 · Pull Request #159 · go-python/gpython

Repository navigation

added examples and py utils - #159


Merged
sbinet merged 14 commits into go-python:master from drew-512:add-examples Feb 12, 2022
Merged

added examples and py utils #159 sbinet merged 14 commits into go-python:master from drew-512:add-examples

Conversation

drew-512 commented Feb 7, 2022



Copy link Copy Markdown
Contributor

No description provided.

added examples and py utils 97ee211

codecov
Bot
commented Feb 7, 2022 · edited Loading



Copy link Copy Markdown

Codecov Report

Merging #159 (c67547f ) into master (727b7c4 ) will decrease coverage by 1.43%.
The diff coverage is 10.36%.

@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
- Coverage   74.40%   72.96%   -1.44%     
==========================================
  Files          66       70       +4     
  Lines       11395    11647     +252     
==========================================
+ Hits         8478     8498      +20     
- Misses       2351     2583     +232     
  Partials      566      566              
Impacted Files Coverage Δ
examples/embedding/main.go 0.00% <0.00%> (ø)
py/util.go 0.00% <0.00%> (ø)
examples/embedding/mylib.module.go 32.25% <32.25%> (ø)
repl/cli/cli.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov .

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov . Last update 727b7c4...c67547f . Read the comment docs .

readme tweaks 41984ce sbinet reviewed Feb 10, 2022
View reviewed changes

sbinet left a comment



Copy link Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more .

looks good.

but could we find a way to wire the examples into either a func ExampleXXX or func TestXXX scaffolding?
so everything is tested w/ go test ./...?
(I guess func TestXXX would be easier)

drew-512 commented Feb 10, 2022



Copy link Copy Markdown
Contributor

Author

I had that thought as well. If I make the example's main optionally output to a file, in the TestXXX variant I could just compare that output against a known output as the test. How does that sound?

sbinet commented Feb 10, 2022



Copy link Copy Markdown
Member

yes, that, or have everything being compiled as part of the func TestXXX:

  • compile the main package,
  • run the output executable with os/exec.Command,
  • capture stdout/stderr and
  • compare with some reference.
    we did something along these lines for go-python/gopy
embedding example now also a test 835e6b0

drew-512 commented Feb 11, 2022



Copy link Copy Markdown
Contributor

Author

How does this look? I'm not well versed in this sort of stuff, so lmk what I'm missing, thanks.

drew-512 commented Feb 11, 2022



Copy link Copy Markdown
Contributor

Author

@sbinet This works on my setup but it looks like I need help getting it work with CI here.

sbinet commented Feb 12, 2022 · edited Loading



Copy link Copy Markdown
Member

it probably is coming from this:

=== RUN   TestEmbeddedExample
    main_test.go:64: could not run diff command: exit status 1
    main_test.go:66: test output differ:
        --- testdata/embedding_golden.txt	2022-02-12 14:36:59.468987820 +0100
        +++ /tmp/go-python-embedding-181936362/out.txt	2022-02-12 14:50:15.575695331 +0100
        @@ -4,7 +4,7 @@
         
         ==========================================================
                 Python 3.4 (github.com/go-python/gpython)
        -        go1.17.6 on darwin amd64
        +        devel go1.18-a5c0b19080 Sun Jan 30 02:29:51 2022 +0000 on linux amd64
         ==========================================================
         
         Spring Break itinerary:
--- FAIL: TestEmbeddedExample (0.50s)
FAIL
FAIL	github.com/go-python/gpython/examples/embedding	0.507s
FAIL
sbinet reviewed Feb 12, 2022
View reviewed changes
drew-512 and others added 8 commits February 12, 2022 09:58 Update examples/embedding/mylib.module.go cdf3d5b
Co-authored-by: Sebastien Binet <binet@cern.ch>
Update examples/embedding/main_test.go 3dff766
Co-authored-by: Sebastien Binet <binet@cern.ch>
Update examples/embedding/main_test.go 249e14e
Co-authored-by: Sebastien Binet <binet@cern.ch>
Update examples/embedding/main_test.go 76c8b51
Co-authored-by: Sebastien Binet <binet@cern.ch>
Update examples/embedding/main_test.go 17f2690
Co-authored-by: Sebastien Binet <binet@cern.ch>
Update examples/embedding/main_test.go e0f7a11
Co-authored-by: Sebastien Binet <binet@cern.ch>
CI-friendly golden testing fixes 4a49a6d golden test output no longer platform specific 16ebe64

drew-512 commented Feb 12, 2022



Copy link Copy Markdown
Contributor

Author

Sigh, so I guess windows needed to be exe.exe? I test for windows at runtime and append an ".exe"?

sbinet reviewed Feb 12, 2022
View reviewed changes
drew-512 and others added 3 commits February 12, 2022 10:45 Update examples/embedding/main_test.go 3d37384
Co-authored-by: Sebastien Binet <binet@cern.ch>
Update examples/embedding/main_test.go ba0f3da
Co-authored-by: Sebastien Binet <binet@cern.ch>
Update examples/embedding/lib/mylib.py c67547f
Co-authored-by: Sebastien Binet <binet@cern.ch>

drew-512 commented Feb 12, 2022



Copy link Copy Markdown
Contributor

Author

yay!

sbinet approved these changes Feb 12, 2022
View reviewed changes

sbinet left a comment



Copy link Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more .

LGTM

sbinet merged commit 7f55cd3 into go-python : master Feb 12, 2022 sbinet mentioned this pull request Feb 13, 2022 Embed into another program #138 Closed drew-512 deleted the add-examples branch February 17, 2022 02:04 Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

2 participants