So, the asciidoc tests fail, for some reason on your machine. Impossible for me to debug, but those same test should pass fine if you create a PR and run the same tests on Travis and friend.
Can I run at least the tests I add to the PR, just those? And know if they passed?
For example, if I add a new test called TestFigureImgHeight, can I run just that using mage? That will give me a better confidence when pushing the PR.
As I said, hard for me to say. Maybe. We could consider just running those tests when on CI (they currently checks for an asciidoc or asciidoctor installation), but I really like having those tests there as a failsafe. I don’t sue Asciidoc nor RST in my daily Hugo life, so it is easy for me to make some change that mucks everything.
km²~/go.apps/:../github.com/kaushalmodi/hugo> go test -v -run=".*TestFigureImgWidth.*"
? github.com/kaushalmodi/hugo [no test files]
I intentionally messed up the TestFigureImgWidth test so that I can see it fail… but go test gives just that… no PASS or FAIL. Can you tell me what exact command you would run to test just that specific test (that I just linked)?
I get the same when trying it in $GOPATH/src/github.com/gohugoio/hugo instead of in my workarea (after intentionally messing up that test):
km²~/go.apps/:../github.com/gohugoio/hugo> go test -v -run=".*TestFigureImgWidth.*"
? github.com/gohugoio/hugo [no test files]
Though looks like I cannot run tests from my workarea… need to work in the original hugo repo only, else I get:
tpl/cast/docshelper.go:19:2: use of internal package not allowed
tpl/collections/init.go:18:2: use of internal package not allowed
tpl/compare/init.go:18:2: use of internal package not allowed
tpl/crypto/init.go:18:2: use of internal package not allowed
tpl/data/init.go:18:2: use of internal package not allowed
tpl/encoding/init.go:18:2: use of internal package not allowed
tpl/fmt/init.go:18:2: use of internal package not allowed
tpl/images/init.go:18:2: use of internal package not allowed
tpl/inflect/init.go:18:2: use of internal package not allowed
tpl/lang/init.go:18:2: use of internal package not allowed
tpl/math/init.go:18:2: use of internal package not allowed
tpl/os/init.go:18:2: use of internal package not allowed
tpl/partials/init.go:18:2: use of internal package not allowed
tpl/safe/init.go:18:2: use of internal package not allowed
tpl/strings/init.go:18:2: use of internal package not allowed
tpl/time/init.go:18:2: use of internal package not allowed
tpl/tplimpl/template_funcs.go:21:2: use of internal package not allowed
tpl/transform/init.go:18:2: use of internal package not allowed
tpl/urls/init.go:18:2: use of internal package not allowed
But at least I can make the test fail from the hugo repo… so will continue from there.
Actually, I just got it working and I saw your reply.
I had to \rm -rf vendor.orig from within the hugo repo dir. Would mage vendor also have included that step? After deleting that dir, the go test .. command works fine.
@kaushalmodi can you please tell me how you were able to solve these errors when you were trying to test locally?
I also get the use of internal package not allowed error when I try for example:
go test -run="TestShortcodeVimeo" ./...
OR
mage vendor hugoRace
mage -v check
Also I don’t see a vendor.orig in the hugo repo dir of my fork. I only see a vendor directory and removing it doesn’t seem to make a difference in the errors I get when trying to run the test.
P.S. I know what the rm -rf command is about but I just don’t feel comfortable to play with it, even in the form of \rm -rf vendor.orig
Not a Go expert, but I’ve learned that such strange errors cropped up if I ran those commands in my cloned fork of Hugo.
I’m assuming you are already doing this, but you need to be in the original Hugo cloned go apps work area, and run the build and test commands from there.