Skip to content
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

assert/cmd/gty-migrate-from-testify: fix TestRun by adding "go get" commands #265

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

The test TestRun of the gty-migrate-from-testify tool apparently needs
to have the original packages available to run. So let's install them
("go get" in GOPATH mode, in a temporary directory) before running the
migration test.
…-check

Fix incorrect import path for go-check in gty-migrate-from-testify test:
github.com/go-check/check => gopkg.in/check.v1
…test

Fix test to use the gopkg.in/check.v1 API correctly.

The func TestWithChecker(c *check.C) was incompatible with "go test".
@dolmen dolmen marked this pull request as draft June 12, 2023 15:33
@dolmen
Copy link
Contributor Author

dolmen commented Jun 12, 2023

Unfortunately I do not get the same failure as https://app.circleci.com/pipelines/github/gotestyourself/gotest.tools/308/workflows/b1924e3f-5a1b-4cc4-967a-566c13157643/jobs/3432?invite=true#step-108-38 when I run the test on my machine (go 1.20):

$ go test -run TestRun -v                                          
=== RUN   TestRun
    main_test.go:16: go get github.com/go-check/check
    main_test.go:16: go get github.com/stretchr/testify/assert
    main_test.go:16: go get github.com/stretchr/testify/require
-: /var/folders/7b/5rfj3bgs3tj34c6f2jy8h39w0000gn/T/test-run-2939663157/src/example.com/example/some_test.go:138:1: wrong signature for TestWithChecker, must be: func TestWithChecker(t *testing.T)
assert.NotContains(t, []bool{}, true) at ../../../../../../../../var/folders/7b/5rfj3bgs3tj34c6f2jy8h39w0000gn/T/test-run-2939663157/src/example.com/example/some_test.go:56: skipping unsupported assertion
--- PASS: TestRun (16.32s)
PASS
ok  	gotest.tools/v3/assert/cmd/gty-migrate-from-testify	16.556s

@dolmen
Copy link
Contributor Author

dolmen commented Jun 12, 2023

I can reproduce the CI failure with:

$ ( cd assert/cmd/gty-migrate-from-testify/testdata/full && export GO111MODULE=off && go get github.com/stretchr/testify/assert && go get gopkg.in/check.v1 && go test )

@dolmen dolmen force-pushed the fix_gty-migrate-from-testify_test_dependencies branch from 3db4fce to fcde373 Compare June 12, 2023 17:01
@dolmen
Copy link
Contributor Author

dolmen commented Jun 12, 2023

I finally had to drop the func TestWithChecker(c *check.C) in testdata/full/some_test.go. See fcde373.

@dolmen dolmen marked this pull request as ready for review June 12, 2023 17:06
@dolmen
Copy link
Contributor Author

dolmen commented Jun 12, 2023

Everything fixed.
Ready for review.

@dolmen
Copy link
Contributor Author

dolmen commented Jun 26, 2023

ping @dnephin

@dnephin
Copy link
Member

dnephin commented Jun 30, 2023

Thanks for working on this! I tried the separate module in #268. I don't understand why only go1.19 is failing. I don't see anything different about that config. It should be using module mode as well. I'll keep debugging.

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