WIP: set up snapshot testing

This commit is contained in:
Isaiah Odhner 2023-09-07 15:14:07 -04:00
parent f81e5d8250
commit ed97f0afb0
5 changed files with 25 additions and 0 deletions

4
.gitignore vendored
View File

@ -1,4 +1,8 @@
# pytest-textual-snapshot
snapshot_report.html
# Temporary backup files from Textual Paint and other editors
*~

View File

@ -123,6 +123,7 @@
"pyperclip",
"pypixelart",
"pyright",
"pytest",
"pyxdg",
"qualname",
"rasterization",

View File

@ -12,3 +12,5 @@ textual[dev]==0.28.0
watchdog==3.0.0 # for development; optional (only used when --restart-on-changes is passed)
types-Pillow==10.0.0.1 # for development
types-psutil==5.9.5.15 # for development
pytest==7.4.1 # for development
pytest-textual-snapshot==0.4.0 # for development

0
tests/__init__.py Normal file
View File

18
tests/test_snapshots.py Normal file
View File

@ -0,0 +1,18 @@
from pathlib import Path
import pytest
# These paths are treated as relative to this file.
APPS_DIR = Path("../src/textual_paint")
PAINT = APPS_DIR / "paint.py"
GALLERY = APPS_DIR / "gallery.py"
def test_paint_app(snap_compare):
assert snap_compare(PAINT)
def test_paint_stretch_skew(snap_compare):
assert snap_compare(PAINT, press=["ctrl+w"])
def test_gallery_app(snap_compare):
assert snap_compare(GALLERY)