diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
index 74538c10d..e333fcd1f 100644
--- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
+++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
@@ -1,4 +1,4 @@
-# name: test_combining_layouts
+# name: test_center_layout
'''
+
+ '''
+# ---
+# name: test_dock_layout_sidebar
+ '''
+
@@ -472,9 +622,472 @@
'''
# ---
-# name: test_x
+# name: test_horizontal_layout
'''
- 123
- 123123123
+
+
+ '''
+# ---
+# name: test_layers
+ '''
+
+
+ '''
+# ---
+# name: test_vertical_layout
+ '''
+
+
'''
# ---
diff --git a/tests/snapshot_tests/conftest.py b/tests/snapshot_tests/conftest.py
index f24ab3512..69cc6d1b3 100644
--- a/tests/snapshot_tests/conftest.py
+++ b/tests/snapshot_tests/conftest.py
@@ -5,10 +5,10 @@ from functools import partial
from operator import attrgetter
from os import PathLike
from pathlib import Path
-from typing import Union, List, Optional, Any, Callable
+from typing import Union, List, Optional, Callable
import pytest
-from _pytest.fixtures import FixtureDef, SubRequest, FixtureRequest
+from _pytest.fixtures import FixtureRequest
from jinja2 import Template
from rich.console import Console
from rich.panel import Panel
@@ -49,20 +49,6 @@ class SvgSnapshotDiff:
line_number: int
-#
-# def pytest_runtestloop(session: "Session") -> Optional[object]:
-
-@pytest.hookimpl(hookwrapper=True)
-def pytest_pyfunc_call(pyfuncitem: "pytest.Function") -> Optional[object]:
- """Call underlying test function.
-
- Stops at first non-None result, see :ref:`firstresult`.
- """
- # Before
- yield
- # After
-
-
def pytest_runtest_teardown(item: pytest.Item, nextitem: Optional[pytest.Item]) -> None:
"""Called to perform the teardown phase for a test item.
@@ -79,26 +65,6 @@ def pytest_runtest_teardown(item: pytest.Item, nextitem: Optional[pytest.Item])
"""
-@pytest.hookimpl(hookwrapper=True)
-def pytest_fixture_setup(
- fixturedef: FixtureDef[Any], request: SubRequest
-) -> Optional[object]:
- """Perform fixture setup execution.
-
- :returns: The return value of the call to the fixture function.
-
- Stops at first non-None result, see :ref:`firstresult`.
-
- .. note::
- If the fixture function returns None, other implementations of
- this hook function will continue to be called, according to the
- behavior of the :ref:`firstresult` option.
- """
- value = yield
- value = value.get_result()
- value = repr(value)
-
-
def pytest_sessionfinish(
session: "pytest.Session",
exitstatus: Union[int, "pytest.ExitCode"],
@@ -120,7 +86,9 @@ def pytest_sessionfinish(
SvgSnapshotDiff(
snapshot=str(snapshot_svg),
actual=str(actual_svg),
- file_similarity=100 * difflib.SequenceMatcher(a=str(snapshot_svg), b=str(actual_svg)).ratio(),
+ file_similarity=100 * difflib.SequenceMatcher(a=str(snapshot_svg),
+ b=str(
+ actual_svg)).ratio(),
test_name=name,
path=path,
line_number=line_index + 1,
@@ -143,8 +111,8 @@ def pytest_sessionfinish(
diffs=diffs,
passes=num_snapshots_passing,
fails=num_fails,
- pass_percentage=100*(num_snapshots_passing/num_snapshot_tests),
- fail_percentage=100*(num_fails/num_snapshot_tests),
+ pass_percentage=100 * (num_snapshots_passing / (num_snapshot_tests + 1)),
+ fail_percentage=100 * (num_fails / (num_snapshot_tests + 1)),
num_snapshot_tests=num_snapshot_tests,
now=datetime.utcnow()
)
diff --git a/tests/snapshot_tests/snapshot_report.html b/tests/snapshot_tests/snapshot_report.html
index f853befd7..294be0c2b 100644
--- a/tests/snapshot_tests/snapshot_report.html
+++ b/tests/snapshot_tests/snapshot_report.html
@@ -14,379 +14,33 @@
Textual Snapshot Tests
- Showing diffs for 1 mismatched snapshot(s)
+ Showing diffs for 0 mismatched snapshot(s)
- 1 snapshots changed
+ 0 snapshots changed
·
- 2 snapshots matched
+ 7 snapshots matched
+ style="width: 0.0%"
+ aria-valuenow="0" aria-valuemin="0" aria-valuemax="7">
+ style="width: 87.5%"
+ aria-valuenow="7" aria-valuemin="0"
+ aria-valuemax="7">
-
-
-
-
-
-
-
-
-
-
- Output from test
-
-
-
-
-
-
- Historical snapshot
-
-
-
-
-
-
-
-
@@ -401,7 +55,7 @@
-
Report generated at UTC 2022-09-16 14:50:47.993944.
+
Report generated at UTC 2022-09-20 12:27:59.430929.
diff --git a/tests/snapshot_tests/snapshot_report_template.jinja2 b/tests/snapshot_tests/snapshot_report_template.jinja2
index a726b9b57..9427a9606 100644
--- a/tests/snapshot_tests/snapshot_report_template.jinja2
+++ b/tests/snapshot_tests/snapshot_report_template.jinja2
@@ -49,7 +49,7 @@
{{ diff.test_name }}
-
({{ "%.2f"|format(diff.file_similarity) }}% similar)
+
({{ "%.2f"|format(diff.file_similarity) }}% source similarity)
{{ diff.path }}:{{ diff.line_number }}
diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py
index d3de89f48..0c95f103c 100644
--- a/tests/snapshot_tests/test_snapshots.py
+++ b/tests/snapshot_tests/test_snapshots.py
@@ -6,9 +6,25 @@ def test_grid_layout_basic_overflow(snap_compare):
assert snap_compare("docs/examples/guide/layout/grid_layout2.py")
-def test_combining_layouts(snap_compare):
- assert snap_compare("docs/examples/guide/layout/combining_layouts.py")
+def test_grid_layout_gutter(snap_compare):
+ assert snap_compare("docs/examples/guide/layout/grid_layout7_gutter.py")
def test_layers(snap_compare):
assert snap_compare("docs/examples/guide/layout/layers.py")
+
+
+def test_center_layout(snap_compare):
+ assert snap_compare("docs/examples/guide/layout/center_layout.py")
+
+
+def test_horizontal_layout(snap_compare):
+ assert snap_compare("docs/examples/guide/layout/horizontal_layout.py")
+
+
+def test_vertical_layout(snap_compare):
+ assert snap_compare("docs/examples/guide/layout/vertical_layout.py")
+
+
+def test_dock_layout_sidebar(snap_compare):
+ assert snap_compare("docs/examples/guide/layout/dock_layout2_sidebar.py")