copyist icon indicating copy to clipboard operation
copyist copied to clipboard

It's impossible to run copyist.Open* from TestMain

Open renom opened this issue 4 months ago • 0 comments

func TestMain(m *testing.M) {
	flag.Parse()
	copyist.Register("postgres")
	copyist.SetSessionInit(resetDB)
	closer := copyist.OpenNamed("test.copyist", "OpenCopyist")
	pop.Connect("copyist-test")
	closer.Close()
	os.Exit(m.Run())
}

This example from README isn't appropriate, because copyist.OpenNamed(t testingT, pathName, recordingName string) io.Closer requires t testingT as a first argument, but there's no t *testing.T in TestMain but only m *testing.M which does not implement testingT.

Is it possible to call Open* from TestMain?

renom avatar Oct 13 '25 12:10 renom