diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f3bc64..fc15e30 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,9 +64,17 @@ jobs: run: | compare_args=$(test -d .benchmarks && echo \ --benchmark-compare \ - --benchmark-compare-fail=mean:5% \ - --benchmark-histogram='test-results/benchmark/histogram') - pytest test --benchmark-autosave $compare_args + --benchmark-compare-fail=mean:5%) \ + pytest test --benchmark-autosave $compare_args + + - name: Create histograms + shell: bash {0} + run: | + if [ -d .benchmarks ]; then + py.test-benchmark compare --histogram='test-results/benchmark/histogram' + else + echo "No previous benchmarks found." + fi - name: Post coverage report to Coveralls uses: coverallsapp/github-action@v2 diff --git a/test/test_trnsys_dck_parser/test_expression.py b/test/test_trnsys_dck_parser/test_expression.py index a1bbe06..3d0cc88 100644 --- a/test/test_trnsys_dck_parser/test_expression.py +++ b/test/test_trnsys_dck_parser/test_expression.py @@ -17,6 +17,10 @@ class _ExpressionTestCase: parser_result: _pexpr.ParseResult benchmark: bool = True + @property + def id(self) -> str: + return f"{self.string[:3]},,{self.string[-3:]}" + def _get_expression_test_cases() -> _tp.Iterable[_ExpressionTestCase]: # pylint: disable=too-many-statements result: _pcom.ParseResult[_mexpr.Expression] @@ -149,7 +153,7 @@ def _get_expression_test_cases() -> _tp.Iterable[_ExpressionTestCase]: # pylint yield _ExpressionTestCase(string, result, benchmark=False) -@_pt.mark.parametrize("test_case", _get_expression_test_cases(), ids=lambda etc: etc.string) +@_pt.mark.parametrize("test_case", _get_expression_test_cases(), ids=lambda etc: etc.id) def test_expression(test_case: _ExpressionTestCase, benchmark) -> None: if test_case.benchmark: actual_expression = benchmark(_build.parse_expression, test_case.string)