Add benchmark & run test in base folder

This commit is contained in:
Gabriel Augendre 2021-08-22 10:08:18 +02:00
parent c143a64bca
commit 2e4bf89368
2 changed files with 12 additions and 1 deletions

View file

@ -171,3 +171,13 @@ func TestNewInseeData_ValidFrenchCorsica(t *testing.T) {
assert.Equal([]string{"FRANCE"}, insee.Countries) assert.Equal([]string{"FRANCE"}, insee.Countries)
assert.Equal(23, insee.ControlKey) assert.Equal(23, insee.ControlKey)
} }
var inseeResult *InseeData
func BenchmarkNewInseeData(b *testing.B) {
var in *InseeData
for i := 0; i < b.N; i++ {
in, _ = NewInseeData("299122A00498723")
}
inseeResult = in
}

View file

@ -25,7 +25,8 @@ BASE_DIR = Path(__file__).parent.resolve(strict=True)
def test(context): def test(context):
"""Run tests""" """Run tests"""
context: Context context: Context
context.run(f"go test {BASE_DIR}/...", echo=True) with context.cd(BASE_DIR):
context.run(f"go test ./... -race -bench .", echo=True)
@task(pre=[test]) @task(pre=[test])