Skip to content

Commit 12daaf6

Browse files
committed
Remove the JPEGs used for visual inspection in regression tests
Signed-off-by: Tomas Pereira de Vasconcelos <tomasvasconcelos1@gmail.com>
1 parent cb299eb commit 12daaf6

9 files changed

Lines changed: 7 additions & 16 deletions

File tree

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ recursive-include cicd_utils README.md *.py *.sh
3939
recursive-include misc *.py *.ipynb *.txt *.png
4040
recursive-include requirements *.txt
4141
recursive-include tests *.py
42-
recursive-include tests/e2e/artifacts *.jpeg *.json
42+
recursive-include tests/e2e/artifacts *.json
4343

4444
# Globally excluded patterns
4545
recursive-exclude * *.py[cod] *.egg-info __pycache__ .ipynb_checkpoints/*

cicd_utils/ridgeplot_examples/_base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ class Example:
7171
def __post_init__(self) -> None:
7272
self.fig = self.figure_factory() # pyright: ignore[reportUninitializedInstanceVariable]
7373

74-
# All example figures must set the layout's width to 800 and
75-
# explicitly declare the layout's height to a concrete value
74+
# Both `width` and `height` should be set in all example plots
7675
if self.fig.layout.width != 800:
7776
raise ValueError("All figures must have width 800")
78-
if self.fig.layout.height is None:
79-
raise ValueError("All figures must have an explicit height declared")
77+
if not isinstance(self.fig.layout.height, int):
78+
raise ValueError("All figures must have an explicit height declared") # noqa: TRY004
8079

8180
round_fig_data(self.fig, sig_figs=8)
8281

@@ -146,6 +145,8 @@ def write_webp(self, path: Path) -> None:
146145
engine="kaleido",
147146
)
148147

148+
# This method isn't used anywhere anymore but
149+
# will be kept here for potential future use
149150
def write_jpeg(self, path: Path) -> None:
150151
fig = deepcopy(self.fig)
151152
fig = tighten_margins(fig, px=40)

docs/reference/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Unreleased changes
2020

2121
### CI/CD
2222

23+
- Remove the JPEGs used for visual inspection in regression tests ({gh-pr}`364`)
2324
- Upgrade ruff's target Python version to 3.10 ({gh-pr}`363`)
2425
- Bump sigstore/gh-action-sigstore-python from 3.1.0 to 3.2.0 ({gh-pr}`359`)
2526
- Bump actions/download-artifact from 5 to 6 ({gh-pr}`354`)

tests/e2e/artifacts/basic.jpeg

-25.5 KB
Binary file not shown.
-24.4 KB
Binary file not shown.
-77.6 KB
Binary file not shown.
-80.1 KB
Binary file not shown.

tests/e2e/artifacts/probly.jpeg

-48 KB
Binary file not shown.

tests/e2e/test_examples.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ def test_paths_exist() -> None:
1818
assert PATH_CHARTS.is_dir()
1919

2020

21-
@pytest.mark.parametrize("example", ALL_EXAMPLES, ids=lambda e: e.plot_id)
22-
def test_examples_width_height_set(example: Example) -> None:
23-
msg = "Both `width` and `height` should be set in all example plots."
24-
assert isinstance(example.fig.layout.width, int), msg
25-
assert isinstance(example.fig.layout.height, int), msg
26-
27-
2821
@pytest.mark.parametrize("example", ALL_EXAMPLES, ids=lambda e: e.plot_id)
2922
def test_json_regressions(example: Example) -> None:
3023
expected = (PATH_ARTIFACTS / f"{example.plot_id}.json").read_text()
@@ -46,10 +39,6 @@ def _update_all_artifacts() -> None:
4639
print(f"Updating artifacts for: {example.plot_id!r}") # noqa: T201
4740
# Save JSONs for regression tests
4841
example.write_json(PATH_ARTIFACTS)
49-
# We also save JPEGs for visual inspection (e.g., in PRs)
50-
# (Don't use JPEGs for regression tests because outputs
51-
# will vary between Plotly versions and platforms)
52-
example.write_jpeg(PATH_ARTIFACTS)
5342
# Just to keep things in sync with the docs, we should also
5443
# regenerate the WebP images used there. These are tracked
5544
# by Git because some are used in the README (which needs

0 commit comments

Comments
 (0)