8000 Improved support for hash comparison only HTML summary · matplotlib/pytest-mpl@1cb3d4e · GitHub
[go: up one dir, main page]

Skip to content

Commit 1cb3d4e

Browse files
committed
Improved support for hash comparison only HTML summary
1 parent 03d1f76 commit 1cb3d4e

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

pytest_mpl/summary/templates/filter.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ <h5>Sort tests by...</h5>
1616
{{ sort_option('status-sort', 'status', 'desc', default=true) }}
1717
{{ sort_option('collected-sort', 'collected', 'asc') }}
1818
{{ sort_option('test-name', 'name') }}
19+
{% if results.warn_missing['baseline_image'] -%}
1920
{{ sort_option('rms-sort', 'RMS', 'desc') }}
21+
{%- endif %}
2022
</div>
2123
<form id="filterForm" onsubmit="return false;">
2224
<h5>Show tests which have...</h5>
@@ -32,11 +34,13 @@ <h5>Show tests which have...</h5>
3234
{{ filter_option('overall-failed', 'failed') }}
3335
{{ filter_option('overall-skipped', 'skipped') }}
3436
</div>
37+
{% if results.warn_missing['baseline_image'] -%}
3538
<div class="list-group m-2">
3639
{{ filter_option('image-match', 'matching images') }}
3740
{{ filter_option('image-diff', 'differing images') }}
3841
{{ filter_option('image-missing', 'no baseline image') }}
3942
</div>
43+
{%- endif %}
4044
{% if results.warn_missing['baseline_hash'] -%}
4145
<div class="list-group m-2 mpl-hash">
4246
{{ filter_option('hash-match', 'matching hashes') }}

pytest_mpl/summary/templates/result_images.html

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ <h6><small class="text-muted">{{ r.module }}</small></h6>
66
</div>
77
<div class="offcanvas-body">
88
<h5 class="card-title">{{ r.name }}</h5>
9+
{% if results.warn_missing['baseline_image'] -%}
910
<div class="row row-cols-1 row-cols-md-3 g-4 mt-3">
1011
{% macro image_card(file, name) -%}
1112
<div class="col py-3 m-0">
@@ -21,6 +22,7 @@ <h5 class="card-title">{{ r.name }}</h5>
2122
{{ image_card(r.diff_image, 'Diff') }}
2223
{{ image_card(r.result_image, 'Result') }}
2324
</div>
25+
{%- endif %}
2426
<div class="row row-cols-1 row-cols-md-2 g-4">
2527
<div class="col">
2628
<div class="card text-white bg-{{ r.status | status_class }}">
@@ -31,19 +33,23 @@ <h5 class="card-title">{{ r.name }}</h5>
3133
</div>
3234
</div>
3335
<div class="col">
36+
{% macro pre_data(id, value, name) -%}
37+
{% filter indent(width=8) -%}
38+
<div class="mb-3 {{ id | replace('_', '-') }}">
39+
<label for="{{ id }}" class="form-label">{{ name }}</label>
40+
<pre class="form-control {{ id | replace('_', '-') }}-value" id="{{ id }}">{{ value }}</pre>
41+
</div>
42+
{%- endfilter %}
43+
{%- endmacro -%}
44+
{% if results.warn_missing['baseline_image'] -%}
3445
<div class="card text-white bg-{{ r.image_status | status_class }} mb-3 mpl-image">
3546
<div class="card-header">{{ r.image_status | image_status_msg }}</div>
3647
<div class="card-body">
37-
{% macro pre_data(id, value, name) -%}
38-
<div class="mb-3 {{ id | replace('_', '-') }}">
39-
<label for="{{ id }}" class="form-label">{{ name }}</label>
40-
<pre class="form-control {{ id | replace('_', '-') }}-value" id="{{ id }}">{{ value }}</pre>
41-
</div>
42-
{%- endmacro -%}
4348
{{ pre_data('rms', r.rms_str, 'RMS') }}
4449
{{ pre_data('tolerance', r.tolerance, 'Tolerance') }}
4550
</div>
4651
</div>
52+
{%- endif %}
4753
{% if results.warn_missing['baseline_hash'] -%}
4854
<div class="card text-white bg-{{ r.hash_status | status_class }} mb-3 mpl-hash">
4955
<div class="card-header">{{ r.hash_status | hash_status_msg }}</div>

pytest_mpl/summary/templates/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ body.no-hash-test .mpl-hash {
3333
display: none;
3434
}
3535
pre {
36-
white-space: pre-wrap;
36+
white-space: pre-line;
3737
}
3838
div.result div.status-badge button img {
3939
vertical-align: sub;

0 commit comments

Comments
 (0)
0