Skip to content

added examples and py utils #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Feb 12, 2022
Merged

added examples and py utils #159

merged 14 commits into from
Feb 12, 2022

Conversation

drew-512
Copy link
Contributor

@drew-512 drew-512 commented Feb 7, 2022

No description provided.

@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

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

Impacted file tree graph

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

Copy link
Member

@sbinet sbinet left a comment

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
Copy link
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
Copy link
Member

sbinet commented Feb 10, 2022

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

@drew-512
Copy link
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
Copy link
Contributor Author

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

@sbinet
Copy link
Member

sbinet commented Feb 12, 2022

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

@drew-512
Copy link
Contributor Author

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

@drew-512
Copy link
Contributor Author

yay!

Copy link
Member

@sbinet sbinet left a comment

Choose a reason for hiding this comment

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

LGTM

@sbinet sbinet merged commit 7f55cd3 into go-python:master Feb 12, 2022
@drew-512 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants