From 2e4bf89368872ecce5c7c2d86a19d66c8766aaaa Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 22 Aug 2021 10:08:18 +0200 Subject: [PATCH] Add benchmark & run test in base folder --- data/insee_data_test.go | 10 ++++++++++ tasks.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/data/insee_data_test.go b/data/insee_data_test.go index 0b3adc6..62798f4 100644 --- a/data/insee_data_test.go +++ b/data/insee_data_test.go @@ -171,3 +171,13 @@ func TestNewInseeData_ValidFrenchCorsica(t *testing.T) { assert.Equal([]string{"FRANCE"}, insee.Countries) 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 +} diff --git a/tasks.py b/tasks.py index 26da3a7..49d1fee 100644 --- a/tasks.py +++ b/tasks.py @@ -25,7 +25,8 @@ BASE_DIR = Path(__file__).parent.resolve(strict=True) def test(context): """Run tests""" 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])