Skip to content

chore: replace snapshottest with syrupy and support py3.12 #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitguardian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ secret:
- .env
- 'tests/unit/cassettes/*'
- 'tests/unit/**/snapshots/*'
- 'tests/unit/verticals/secret/output/__snapshots__/*'
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13, windows-2022]
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: \.importlinter|tests/unit/verticals/secret/output/snapshots/.*|tests/unit/core/scan/test_commit_utils.py
exclude: \.importlinter|tests/unit/verticals/secret(/output)?/__snapshots__/.*|tests/unit/core/scan/test_commit_utils.py
- id: check-json
- id: check-added-large-files
- id: check-yaml
Expand Down
594 changes: 268 additions & 326 deletions pdm.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.9",
"Operating System :: OS Independent",
"Topic :: Security",
Expand Down Expand Up @@ -123,7 +124,7 @@ tests = [
"pytest-xdist",
"pytest-voluptuous",
"seed-isort-config",
"snapshottest",
"syrupy",
"import-linter",
"jsonschema",
"vcrpy>=5.1.0",
Expand Down
Empty file.
Empty file.
19 changes: 0 additions & 19 deletions tests/unit/core/scan/snapshots/snap_test_scannable.py

This file was deleted.

3 changes: 1 addition & 2 deletions tests/unit/core/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import pytest
from pygitguardian.models import Match, PolicyBreak
from snapshottest import Snapshot

from ggshield.core.filter import censor_match, censor_string, get_ignore_sha
from tests.unit.conftest import (
Expand Down Expand Up @@ -69,7 +68,7 @@ def test_get_ignore_sha(
policy_breaks: List[PolicyBreak],
duplicates: bool,
expected_shas: Set[str],
snapshot: Snapshot,
snapshot,
) -> None:
copy_policy_breaks = copy.deepcopy(policy_breaks)
if duplicates:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# serializer version: 1
# name: test_handle_scan_error[single file exception]
'''
Error: Scanning failed. Results may be incomplete.
Error: Add the following files to your ignored_paths:
Error: - /home/user/too/long/file/name: filename:: [ErrorDetail(string='Ensure this field has no more than 256 characters.', code='max_length')]

'''
# ---
# name: test_handle_scan_error[source not found]
'''
Error: The provided source was not found in GitGuardian.

'''
# ---
# name: test_handle_scan_error[too many documents]
'''
Error: Scanning failed. Results may be incomplete.
Error: The following chunk is affected:
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
- /example
Error: 400:Too many documents to scan

'''
# ---
Loading
Loading