diff --git a/tests/__snapshots__/test_release.ambr b/tests/__snapshots__/test_release.ambr index 23354d3b..d8268724 100644 --- a/tests/__snapshots__/test_release.ambr +++ b/tests/__snapshots__/test_release.ambr @@ -119,7 +119,7 @@ list([ 'rm', '-rf', - PosixPath('dist'), + 'dist', ]), ), dict({ @@ -145,7 +145,7 @@ list([ 'ls', '-l', - PosixPath('dist'), + 'dist', ]), ), dict({ @@ -158,7 +158,7 @@ list([ 'tar', 'tvf', - PosixPath('dist/archive1'), + 'dist/archive1', ]), ), dict({ @@ -171,7 +171,7 @@ list([ 'tar', 'tvf', - PosixPath('dist/archive2'), + 'dist/archive2', ]), ), dict({ @@ -184,7 +184,7 @@ list([ 'tar', 'tvf', - PosixPath('dist/archive3'), + 'dist/archive3', ]), ), dict({ @@ -199,7 +199,7 @@ 'upload', '--repository', 'testpypi', - PosixPath('dist/*'), + 'dist/*', ]), ), dict({ diff --git a/tests/test_release.py b/tests/test_release.py index 5cfebd45..0ec724cb 100644 --- a/tests/test_release.py +++ b/tests/test_release.py @@ -3,13 +3,14 @@ from __future__ import annotations import dataclasses -import sys from collections.abc import Iterator +from pathlib import Path from typing import Any from unittest import mock import pytest from syrupy.assertion import SnapshotAssertion +from syrupy.matchers import path_type from scripts import release @@ -47,9 +48,18 @@ def mocks() -> Iterator[Mocks]: ) -@pytest.mark.skipif( - sys.platform == "win32", reason="Snapshot paths are different on Windows" -) +@pytest.fixture +def snapshot(snapshot: SnapshotAssertion) -> SnapshotAssertion: + """Override syrupy's snapshot. + + * Simplify platform-dependent `Path` serialization, so the same snapshot + works on multiple platforms. + """ + return snapshot.with_defaults( + matcher=path_type(types=(Path,), replacer=lambda data, _: str(data)) + ) + + def test_happy_path( capsys: pytest.CaptureFixture[str], mocks: Mocks,