Skip to content

Commit b486636

Browse files
committed
ci: arrange correct test environment (PYTHONUBUFFERED, LD_LIBRARY_PATH)
1 parent e3449b5 commit b486636

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ before_install:
2828
# GOPY_TRAVIS_CI is set
2929
- export GOPY_TRAVIS_CI=1
3030
- export GOTRACEBACK=crash
31-
# make python output (sys.stdout, sys.stderr) unbuffered
32-
- export PYTHONUNBUFFERED=1
33-
# ls needs to look into the current directory to load the _go.so library
34-
- export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:.
3531
# pypy3 isn't packaged in ubuntu yet.
3632
- TEMPDIR=$(mktemp -d)
3733
- export PYPYVERSION=v7.1.1

main_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ var (
4646
"_examples/unicode": []string{"py3"}, // doesn't work for 2
4747
"_examples/osfile": []string{"py2", "py3"},
4848
}
49+
50+
testEnvironment = os.Environ()
4951
)
5052

5153
func TestGovet(t *testing.T) {
@@ -839,6 +841,7 @@ func testPkgBackend(t *testing.T, pyvm string, table pkg) {
839841

840842
fmt.Printf("running %s test.py\n", pyvm)
841843
cmd := exec.Command(pyvm, "./test.py")
844+
cmd.Env = testEnvironment
842845
cmd.Dir = tstDir
843846
cmd.Stdin = os.Stdin
844847
buf, err := cmd.CombinedOutput()

main_unix_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
package main
88

99
import (
10+
"fmt"
1011
"log"
1112
"os"
1213
"os/exec"
1314
"strings"
1415
)
1516

1617
func init() {
18+
19+
// ld needs to look into the current directory to load the _go.so library
20+
os.Setenv("LD_LIBRARY_PATH", fmt.Sprintf("%s:.", os.Getenv("LD_LIBRARY_PATH")))
21+
testEnvironment = os.Environ()
22+
1723
var (
1824
py2 = "python2"
1925
py3 = "python3"

0 commit comments

Comments
 (0)