package torrent
import (
- "io/ioutil"
"log"
"os"
"testing"
-)
-// A top-level temp dir that lasts for the duration of the package tests, and
-// is removed at completion.
-var pkgTempDir string
+ _ "github.com/anacrolix/envpprof"
+ analog "github.com/anacrolix/log"
+)
func init() {
- log.SetFlags(log.LstdFlags | log.Llongfile)
- var err error
- pkgTempDir, err = ioutil.TempDir("", "torrent.test")
- if err != nil {
- panic(err)
- }
-}
-
-func tempDir() string {
- ret, err := ioutil.TempDir(pkgTempDir, "")
- if err != nil {
- panic(err)
- }
- return ret
+ log.SetFlags(log.LstdFlags | log.Lshortfile)
+ analog.DefaultTimeFormatter = analog.TimeFormatSecondsSinceInit
}
func TestMain(m *testing.M) {
code := m.Run()
- os.RemoveAll(pkgTempDir)
// select {}
os.Exit(code)
}