Skip to content

Commit ef7aa67

Browse files
authored
Merge pull request #1118 from GitGuardian/gg-hh/832/replace_snapshottest
chore: replace snapshottest with syrupy and support py3.12
2 parents bad74e6 + 13cf4bf commit ef7aa67

File tree

17 files changed

+753
-774
lines changed

17 files changed

+753
-774
lines changed

.gitguardian.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ secret:
3434
- .env
3535
- 'tests/unit/cassettes/*'
3636
- 'tests/unit/**/snapshots/*'
37+
- 'tests/unit/verticals/secret/output/__snapshots__/*'

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
fail-fast: false
8080
matrix:
8181
os: [ubuntu-22.04, macos-13, windows-2022]
82-
python-version: ['3.9', '3.10', '3.11']
82+
python-version: ['3.9', '3.10', '3.11', '3.12']
8383
steps:
8484
- uses: actions/checkout@v4
8585
with:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
rev: v5.0.0
1717
hooks:
1818
- id: trailing-whitespace
19-
exclude: \.importlinter|tests/unit/verticals/secret/output/snapshots/.*|tests/unit/core/scan/test_commit_utils.py
19+
exclude: \.importlinter|tests/unit/verticals/secret(/output)?/__snapshots__/.*|tests/unit/core/scan/test_commit_utils.py
2020
- id: check-json
2121
- id: check-added-large-files
2222
- id: check-yaml

pdm.lock

Lines changed: 13 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ classifiers = [
2727
"Programming Language :: Python :: 3",
2828
"Programming Language :: Python :: 3.10",
2929
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
3031
"Programming Language :: Python :: 3.9",
3132
"Operating System :: OS Independent",
3233
"Topic :: Security",
@@ -123,7 +124,7 @@ tests = [
123124
"pytest-xdist",
124125
"pytest-voluptuous",
125126
"seed-isort-config",
126-
"snapshottest",
127+
"syrupy",
127128
"import-linter",
128129
"jsonschema",
129130
"vcrpy>=5.1.0",

tests/unit/cmd/snapshots/__init__.py

Whitespace-only changes.

tests/unit/core/scan/snapshots/__init__.py

Whitespace-only changes.

tests/unit/core/scan/snapshots/snap_test_scannable.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/unit/core/test_filter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import pytest
66
from pygitguardian.models import Match, PolicyBreak
7-
from snapshottest import Snapshot
87

98
from ggshield.core.filter import censor_match, censor_string, get_ignore_sha
109
from tests.unit.conftest import (
@@ -69,7 +68,6 @@ def test_get_ignore_sha(
6968
policy_breaks: List[PolicyBreak],
7069
duplicates: bool,
7170
expected_shas: Set[str],
72-
snapshot: Snapshot,
7371
) -> None:
7472
copy_policy_breaks = copy.deepcopy(policy_breaks)
7573
if duplicates:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# serializer version: 1
2+
# name: test_handle_scan_error[single file exception]
3+
'''
4+
Error: Scanning failed. Results may be incomplete.
5+
Error: Add the following files to your ignored_paths:
6+
Error: - /home/user/too/long/file/name: filename:: [ErrorDetail(string='Ensure this field has no more than 256 characters.', code='max_length')]
7+
8+
'''
9+
# ---
10+
# name: test_handle_scan_error[source not found]
11+
'''
12+
Error: The provided source was not found in GitGuardian.
13+
14+
'''
15+
# ---
16+
# name: test_handle_scan_error[too many documents]
17+
'''
18+
Error: Scanning failed. Results may be incomplete.
19+
Error: The following chunk is affected:
20+
- /example
21+
- /example
22+
- /example
23+
- /example
24+
- /example
25+
- /example
26+
- /example
27+
- /example
28+
- /example
29+
- /example
30+
- /example
31+
- /example
32+
- /example
33+
- /example
34+
- /example
35+
- /example
36+
- /example
37+
- /example
38+
- /example
39+
- /example
40+
- /example
41+
Error: 400:Too many documents to scan
42+
43+
'''
44+
# ---

0 commit comments

Comments
 (0)