Skip to content

Commit

Permalink
Shorten test IDs and generate histogram over all runs.
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckerruebe committed May 2, 2024
1 parent 7848741 commit 330d894
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion test/test_trnsys_dck_parser/test_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 330d894

Please sign in to comment.