Skip to content

Commit 15b4ba2

Browse files
committed
[components docs] Opt-in to regenerating screenshots
1 parent ba5d017 commit 15b4ba2

File tree

6 files changed

+20
-5
lines changed

6 files changed

+20
-5
lines changed

Diff for: docs/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ sphinx_objects_inv:
3232
regenerate_cli_snippets:
3333
cd ../examples/docs_beta_snippets && tox -e docs_snapshot_update && echo "\nSnippets regenerated!"
3434

35+
regenerate_cli_snippets_and_screenshots:
36+
cd ../examples/docs_beta_snippets && EXTRA_PARAMS='--update-screenshots' tox -e docs_snapshot_update && echo "\nSnippets regenerated!"
37+
3538
regenerate_cli_snippets_and_test:
3639
cd ../examples/docs_beta_snippets && tox -e docs_snapshot_update && tox -e docs_snapshot_test && echo "\nSnippets regenerated and tested!"
3740

Loading

Diff for: examples/docs_beta_snippets/docs_beta_snippets_tests/snippet_checks/conftest.py

+9
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ def pytest_addoption(parser: pytest.Parser) -> None:
88
"--update-snippets",
99
action="store_true",
1010
)
11+
parser.addoption(
12+
"--update-screenshots",
13+
action="store_true",
14+
)
1115

1216

1317
@pytest.fixture
1418
def update_snippets(request: pytest.FixtureRequest) -> bool:
1519
return bool(request.config.getoption("--update-snippets"))
1620

1721

22+
@pytest.fixture
23+
def update_screenshots(request: pytest.FixtureRequest) -> bool:
24+
return bool(request.config.getoption("--update-screenshots"))
25+
26+
1827
@pytest.fixture(scope="session")
1928
def get_selenium_driver():
2029
from selenium import webdriver

Diff for: examples/docs_beta_snippets/docs_beta_snippets_tests/snippet_checks/guides/components/test_components_docs_creating_a_component.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
)
3030

3131

32-
def test_components_docs_index(update_snippets: bool, get_selenium_driver) -> None:
32+
def test_components_docs_index(
33+
update_snippets: bool, update_screenshots: bool, get_selenium_driver
34+
) -> None:
3335
snip_no = 0
3436

3537
def next_snip_no():
@@ -130,7 +132,7 @@ def next_snip_no():
130132
/ "projects-and-components"
131133
/ "components"
132134
/ "component-type-docs.png",
133-
update_snippets=update_snippets,
135+
update_screenshots=update_screenshots,
134136
)
135137

136138
#########################################################

Diff for: examples/docs_beta_snippets/docs_beta_snippets_tests/snippet_checks/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,11 @@ def screenshot_page(
286286
get_webdriver: "Callable[[], webdriver.Chrome]",
287287
url: str,
288288
path: Path,
289-
update_snippets: bool,
289+
update_screenshots: bool,
290290
width: Optional[int] = 1024,
291291
height: Optional[int] = 768,
292292
) -> None:
293-
if not update_snippets:
293+
if not update_screenshots:
294294
return
295295
webdriver = get_webdriver()
296296
webdriver.set_window_size(width, height)

Diff for: examples/docs_beta_snippets/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ passenv =
88
COVERALLS_REPO_TOKEN
99
POSTGRES_TEST_DB_HOST
1010
BUILDKITE*
11+
EXTRA_PARAMS
1112
install_command = uv pip install {opts} {packages}
1213
deps =
1314
duckdb
@@ -92,4 +93,4 @@ commands =
9293
docs_snapshot_test: sh ./docs_beta_snippets_tests/ensure_snapshot_deps.sh
9394
docs_snapshot_test: pytest -c ../../pyproject.toml -vv {posargs} docs_beta_snippets_tests/snippet_checks
9495
docs_snapshot_update: sh ./docs_beta_snippets_tests/ensure_snapshot_deps.sh
95-
docs_snapshot_update: pytest -c ../../pyproject.toml -vv {posargs} docs_beta_snippets_tests/snippet_checks --update-snippets
96+
docs_snapshot_update: pytest -c ../../pyproject.toml -vv {posargs} docs_beta_snippets_tests/snippet_checks --update-snippets {env:EXTRA_PARAMS}

0 commit comments

Comments
 (0)