inline-snapshot 0.36.0__tar.gz → 0.36.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- inline_snapshot-0.36.2/.github/workflows/benchmark-report.yml +31 -0
- inline_snapshot-0.36.2/.github/workflows/benchmarks.yml +45 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/workflows/ci.yml +8 -8
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.gitignore +1 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/CHANGELOG.md +26 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/CONTRIBUTING.md +6 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/PKG-INFO +1 -1
- inline_snapshot-0.36.2/asv.conf.json +49 -0
- inline_snapshot-0.36.2/benchmarks/README.md +58 -0
- inline_snapshot-0.36.2/benchmarks/__init__.py +1 -0
- inline_snapshot-0.36.2/benchmarks/_fixtures.py +64 -0
- inline_snapshot-0.36.2/benchmarks/_workloads.py +212 -0
- inline_snapshot-0.36.2/benchmarks/bench_pytest.py +119 -0
- inline_snapshot-0.36.2/benchmarks/bench_snapshot.py +144 -0
- inline_snapshot-0.36.2/known_issues/pydantic-ai-report-memory.md +167 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/pyproject.toml +12 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_adapter_context.py +3 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_custom_code.py +10 -1
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_external.py +87 -41
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_external_base.py +40 -19
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_external_file.py +57 -33
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_outsource.py +2 -2
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_get_snapshot_value.py +2 -2
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_global_state.py +5 -2
- inline_snapshot-0.36.2/src/inline_snapshot/_inline_snapshot.py +87 -0
- inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/_operation/__init__.py +1 -0
- inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/_operation/base.py +23 -0
- inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/_operation/collection_operation.py +122 -0
- inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/_operation/dict_operation.py +134 -0
- inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/_operation/eq_operation.py +86 -0
- inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/_operation/min_max_operation.py +144 -0
- inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/snapshot_data.py +53 -0
- inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/snapshot_value.py +204 -0
- inline_snapshot-0.36.0/src/inline_snapshot/_snapshot/undecided_value.py → inline_snapshot-0.36.2/src/inline_snapshot/_snapshot/value_conversion.py +5 -62
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_snapshot_arg.py +83 -52
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_snapshot_session.py +12 -20
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_types.py +4 -14
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_unmanaged.py +14 -8
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_utils.py +17 -2
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/fix_pytest_diff.py +3 -3
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/pydantic_fix.py +2 -2
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/version.py +1 -1
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/adapter/test_dataclass.py +1 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/adapter/test_general.py +28 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/adapter/test_sequence.py +2 -1
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/conftest.py +26 -17
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/test_external.py +40 -2
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/test_external_file.py +26 -3
- inline_snapshot-0.36.2/tests/test_benchmark_fixtures.py +143 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_change.py +14 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_change_collection_error.py +10 -14
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_get_snapshot_value.py +0 -1
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_inline_snapshot.py +115 -5
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_preserve_values.py +1 -1
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_pytest_plugin.py +20 -4
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_skip_updates.py +32 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_snapshot_arg.py +60 -2
- inline_snapshot-0.36.2/tests/test_snapshot_arg_unmanaged.py +41 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_without_node.py +4 -2
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_xfail.py +43 -2
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/uv.lock +318 -1
- inline_snapshot-0.36.0/src/inline_snapshot/_inline_snapshot.py +0 -137
- inline_snapshot-0.36.0/src/inline_snapshot/_snapshot/collection_value.py +0 -110
- inline_snapshot-0.36.0/src/inline_snapshot/_snapshot/dict_value.py +0 -107
- inline_snapshot-0.36.0/src/inline_snapshot/_snapshot/eq_value.py +0 -62
- inline_snapshot-0.36.0/src/inline_snapshot/_snapshot/generic_value.py +0 -132
- inline_snapshot-0.36.0/src/inline_snapshot/_snapshot/min_max_value.py +0 -135
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/FUNDING.yml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/actions/setup/action.yml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/copilot-instructions.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/pull_request_template.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/workflows/cog.yml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/workflows/deploy_development_docs.yml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/workflows/docs.yml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.github/workflows/test_docs.yml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.inline-snapshot/external/.gitignore +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.inline-snapshot/external/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d.json +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.inline-snapshot/files_using_external.txt +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/.pre-commit-config.yaml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/AGENTS.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/LICENSE +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/MANIFEST.in +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/README.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/changelog.d/.gitkeep +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/conftest.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/alternatives.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/code_generation/string-update.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/create_fix.mp4 +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/favicon.png +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/favicon.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/introduction/show-error.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/introduction/simple-example-changed.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/introduction/simple-example.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/logo.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/logo_orig.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/pycharm_run.mp4 +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/pytest/create-fix-trim-update.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/pytest/report.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/pytest/review.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/pytest/short-report.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/readme/example-snapshot-arg.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/assets/readme/example-snapshot.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/categories.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/changelog.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/cmp_snapshot.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/code_generation.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/configuration.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/contributing.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/customize_repr.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/eq_snapshot.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/external/assets/register-is-array-for.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/external/assets/register-numberset-format.rich.svg +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/external/external.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/external/external_file.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/external/outsource.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/external/register_format.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/extra.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/fix_assert.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/get_snapshot_value.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/getitem_snapshot.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/howto/parametrize.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/in_snapshot.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/index.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/insiders.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/limitations.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/plugin.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/plugins/pyproject.toml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/plugins/replace_url.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/pycharm.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/pytest.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/snapshot_arg.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/styles/extra.css +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/testing.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/theme/main.html +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/third_party.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/docs/types.md +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/mkdocs.yml +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/redeploy_docs.sh +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/scripts/clean_changelog_fragments.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/scripts/replace_words.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/scripts/test_downstream.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_align.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_change.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_code_repr.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_compare_context.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_config.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_builder.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_custom.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_custom_call.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_custom_dict.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_custom_external.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_custom_sequence.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_custom_undefined.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_custom_unmanaged.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_customize/_uncustomized.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_exceptions.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_diff.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_external_location.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_find_external.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_format/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_format/_binary.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_format/_json.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_format/_protocol.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_format/_rich_svg.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_format/_text.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_storage/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_storage/_hash.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_storage/_protocol.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_storage/_uuid.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_external/_tracked_files.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_fix_assert.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_flags.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_format.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_generator_utils.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_is.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_new_adapter.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_problems.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_rewrite_code.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_sentinels.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_snapshot/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/_source_file.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/extra.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/fix_pytest_cache.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/plugin/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/plugin/_default_plugin.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/plugin/_spec.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/py.typed +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/pytest_plugin.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/syntax_warnings.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/testing/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/testing/_example.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/src/inline_snapshot/testing/_terminal_svg.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/test-repos.json +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/testing/generate_tests.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/adapter/test_call.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/adapter/test_change_types.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/adapter/test_dict.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/adapter/test_namedtuple.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/__init__.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/storage/test_generic.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/storage/test_hash.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/storage/test_uuid.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/test_external_location.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/test_formats.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/external/test_module_name.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_align.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_builder.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_ci.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_code_repr.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_config.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_customize.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_datetime_timezone.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_dirty_equals.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_docs.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_encoding.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_example.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_formatting.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_fstring.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_hasrepr.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_is.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_pydantic.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_pypy.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_pytest_diff_fix.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_pytester.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_raises.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_rewrite_code.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_snapshot_value.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_storage.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_string.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_transformed.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_typing.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_update.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_warns.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/test_xdist.py +0 -0
- {inline_snapshot-0.36.0 → inline_snapshot-0.36.2}/tests/utils.py +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Benchmark PR report
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: [Benchmarks]
|
|
6
|
+
types: [completed]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
actions: read
|
|
10
|
+
pull-requests: write
|
|
11
|
+
issues: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
report:
|
|
15
|
+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
19
|
+
with:
|
|
20
|
+
name: benchmark-results
|
|
21
|
+
path: results
|
|
22
|
+
github-token: ${{ github.token }}
|
|
23
|
+
run-id: ${{ github.event.workflow_run.id }}
|
|
24
|
+
- uses: HaoZeke/asv-perch@3910616093eb463672fec90a2011ff71bfdff071
|
|
25
|
+
with:
|
|
26
|
+
github-token: ${{ github.token }}
|
|
27
|
+
comparison-text-file: results/comparison.txt
|
|
28
|
+
metadata-file: results/metadata.txt
|
|
29
|
+
pr-sha: ${{ github.event.workflow_run.head_sha }}
|
|
30
|
+
regression-threshold: '1.1'
|
|
31
|
+
auto-draft-on-regression: 'false'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Benchmarks
|
|
2
|
+
|
|
3
|
+
on: pull_request
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: read
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: benchmarks-${{ github.event.pull_request.number }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
benchmark:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
timeout-minutes: 60
|
|
16
|
+
env:
|
|
17
|
+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
18
|
+
PR_SHA: ${{ github.event.pull_request.head.sha }}
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
|
+
with:
|
|
22
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
23
|
+
fetch-depth: 0
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
- uses: ./.github/actions/setup
|
|
26
|
+
with:
|
|
27
|
+
python-version: '3.12'
|
|
28
|
+
- name: Benchmark base and PR
|
|
29
|
+
run: |
|
|
30
|
+
git fetch --no-tags origin "$BASE_SHA"
|
|
31
|
+
printf '%s\n' "$BASE_SHA" "$PR_SHA" > commits.txt
|
|
32
|
+
uv run --frozen --group benchmark asv machine --yes
|
|
33
|
+
uv run --frozen --group benchmark asv run HASHFILE:commits.txt --record-samples --interleave-rounds --show-stderr --no-pull
|
|
34
|
+
- name: Compare results
|
|
35
|
+
# Use the API because the CLI exits with an error on regressions.
|
|
36
|
+
run: |
|
|
37
|
+
uv run --no-project --python 3.12 \
|
|
38
|
+
--with 'asv-spyglass @ git+https://github.com/airspeed-velocity/asv_spyglass.git@810ba45dbebc293c1a36f442bda4b4a9bc997695' \
|
|
39
|
+
python -c 'import sys; from asv_spyglass.compare import do_compare; print(do_compare(*sys.argv[1:], label_before="base", label_after="pr")[0])' \
|
|
40
|
+
.asv/results/*/"${BASE_SHA:0:8}"*.json .asv/results/*/"${PR_SHA:0:8}"*.json .asv/results/benchmarks.json > .asv/results/comparison.txt
|
|
41
|
+
echo "base_sha=$BASE_SHA" > .asv/results/metadata.txt
|
|
42
|
+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
43
|
+
with:
|
|
44
|
+
name: benchmark-results
|
|
45
|
+
path: .asv/results/
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
strategy:
|
|
25
25
|
matrix:
|
|
26
26
|
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14', pypy3.11]
|
|
27
|
-
os: [ubuntu-latest, windows-2022, macos-
|
|
27
|
+
os: [ubuntu-latest, windows-2022, macos-15]
|
|
28
28
|
extra_deps: ['"--with=pydantic<2"', '"--with=pydantic>2"']
|
|
29
29
|
is_insider:
|
|
30
30
|
- ${{contains(github.repository, '-insiders/')}}
|
|
@@ -33,20 +33,20 @@ jobs:
|
|
|
33
33
|
- is_insider: true
|
|
34
34
|
os: windows-2022
|
|
35
35
|
- is_insider: true
|
|
36
|
-
os: macos-
|
|
36
|
+
os: macos-15
|
|
37
37
|
|
|
38
38
|
- python-version: '3.14'
|
|
39
39
|
extra_deps: '"--with=pydantic<2"'
|
|
40
40
|
|
|
41
|
-
- os: macos-
|
|
41
|
+
- os: macos-15
|
|
42
42
|
python-version: '3.10'
|
|
43
|
-
- os: macos-
|
|
43
|
+
- os: macos-15
|
|
44
44
|
python-version: '3.11'
|
|
45
|
-
- os: macos-
|
|
45
|
+
- os: macos-15
|
|
46
46
|
python-version: '3.12'
|
|
47
|
-
- os: macos-
|
|
47
|
+
- os: macos-15
|
|
48
48
|
python-version: '3.13'
|
|
49
|
-
- os: macos-
|
|
49
|
+
- os: macos-15
|
|
50
50
|
python-version: pypy3.11
|
|
51
51
|
|
|
52
52
|
- os: windows-2022
|
|
@@ -118,7 +118,7 @@ jobs:
|
|
|
118
118
|
uvx coverage html --skip-covered --skip-empty
|
|
119
119
|
|
|
120
120
|
# Report and write to summary.
|
|
121
|
-
uvx coverage report --format=markdown --skip-covered --skip-empty -m >> $GITHUB_STEP_SUMMARY
|
|
121
|
+
uvx coverage report --format=markdown --skip-covered --skip-empty -m >> "$GITHUB_STEP_SUMMARY"
|
|
122
122
|
uvx coverage report --skip-covered --skip-empty -m > htmlcov/report.txt
|
|
123
123
|
|
|
124
124
|
# Report again and fail if under 100%.
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
|
|
2
|
+
<a id='changelog-0.36.2'></a>
|
|
3
|
+
# v0.36.2 — 2026-11-09
|
|
4
|
+
|
|
5
|
+
## Fixed
|
|
6
|
+
|
|
7
|
+
- Reduce memory use in active snapshot modes by eagerly recording snapshot changes without retaining completed test frames until the final report.
|
|
8
|
+
|
|
9
|
+
<a id='changelog-0.36.1'></a>
|
|
10
|
+
# v0.36.1 — 2026-10-12
|
|
11
|
+
|
|
12
|
+
## Changed
|
|
13
|
+
|
|
14
|
+
- Defer generating source representations until they are needed, improving performance when comparing matching snapshots with updates disabled.
|
|
15
|
+
|
|
16
|
+
- Speed up snapshot conversion for literal constants, especially in large lists and dictionaries.
|
|
17
|
+
- Built-in literal values are always managed; attempting to register their types as unmanaged raises `TypeError`.
|
|
18
|
+
- Scope unmanaged type registrations to the current snapshot context, inheriting registrations from the parent context.
|
|
19
|
+
|
|
20
|
+
- Speed up snapshot comparisons by avoiding unnecessary deep copies of immutable built-in values.
|
|
21
|
+
|
|
22
|
+
- Speed up snapshot conversion by reading AST constant values directly instead of compiling and evaluating them.
|
|
23
|
+
|
|
24
|
+
## Fixed
|
|
25
|
+
|
|
26
|
+
- Respect `show-updates` in the short report, hiding snapshot representation change messages when it is disabled.
|
|
27
|
+
|
|
2
28
|
<a id='changelog-0.36.0'></a>
|
|
3
29
|
# 0.36.0 — 2026-10-02
|
|
4
30
|
|
|
@@ -33,5 +33,11 @@ else:
|
|
|
33
33
|
```
|
|
34
34
|
This serves also as an additional check during runtime.
|
|
35
35
|
|
|
36
|
+
# Performance
|
|
37
|
+
|
|
38
|
+
Use the [ASV benchmark suite](https://github.com/15r10nk/inline-snapshot/blob/main/benchmarks/README.md) to compare snapshot performance
|
|
39
|
+
between commits and record performance history. Benchmarks are separate from
|
|
40
|
+
correctness tests and include both individual comparisons and full pytest runs.
|
|
41
|
+
|
|
36
42
|
# Commits
|
|
37
43
|
Please use [pre-commit](https://pre-commit.com/) for your commits.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: inline-snapshot
|
|
3
|
-
Version: 0.36.
|
|
3
|
+
Version: 0.36.2
|
|
4
4
|
Summary: golden master/snapshot/approval testing library which puts the values right into your source code
|
|
5
5
|
Project-URL: Changelog, https://15r10nk.github.io/inline-snapshot/latest/changelog/
|
|
6
6
|
Project-URL: Discussions, https://github.com/15r10nk/inline-snapshots/discussions
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"project": "inline-snapshot",
|
|
4
|
+
"project_url": "https://15r10nk.github.io/inline-snapshot/",
|
|
5
|
+
"repo": ".",
|
|
6
|
+
"branches": ["HEAD", "main"],
|
|
7
|
+
"show_commit_url": "https://github.com/15r10nk/inline-snapshot/commit/",
|
|
8
|
+
"environment_type": "uv",
|
|
9
|
+
"build_command": [
|
|
10
|
+
"python -m pip wheel --no-deps --no-build-isolation -w {build_cache_dir} {build_dir}"
|
|
11
|
+
],
|
|
12
|
+
"install_command": [
|
|
13
|
+
"in-dir={env_dir} python -m pip install --no-deps --force-reinstall {wheel_file}"
|
|
14
|
+
],
|
|
15
|
+
"pythons": ["3.12"],
|
|
16
|
+
"matrix": {
|
|
17
|
+
"req": {
|
|
18
|
+
"annotated-types": ["0.8.0"],
|
|
19
|
+
"asv-runner": ["0.3.1"],
|
|
20
|
+
"asttokens": ["3.0.1"],
|
|
21
|
+
"black": ["25.1.0"],
|
|
22
|
+
"click": ["8.5.0"],
|
|
23
|
+
"dirty-equals": ["0.11"],
|
|
24
|
+
"executing": ["2.2.1"],
|
|
25
|
+
"hatchling": ["1.32.4"],
|
|
26
|
+
"iniconfig": ["2.3.1"],
|
|
27
|
+
"markdown-it-py": ["4.2.0"],
|
|
28
|
+
"mdurl": ["0.1.2"],
|
|
29
|
+
"mypy-extensions": ["1.1.0"],
|
|
30
|
+
"packaging": ["26.3"],
|
|
31
|
+
"pathspec": ["1.1.1"],
|
|
32
|
+
"platformdirs": ["4.12.3"],
|
|
33
|
+
"pluggy": ["1.6.0"],
|
|
34
|
+
"pydantic": ["2.13.4"],
|
|
35
|
+
"pydantic-core": ["2.46.4"],
|
|
36
|
+
"pygments": ["2.21.0"],
|
|
37
|
+
"pytest": ["9.0.3"],
|
|
38
|
+
"rich": ["15.0.0"],
|
|
39
|
+
"trove-classifiers": ["2026.9.21.13"],
|
|
40
|
+
"typing-extensions": ["4.16.0"],
|
|
41
|
+
"typing-inspection": ["0.4.4"]
|
|
42
|
+
},
|
|
43
|
+
"env": {"PYTHONHASHSEED": ["0"]}
|
|
44
|
+
},
|
|
45
|
+
"benchmark_dir": "benchmarks",
|
|
46
|
+
"env_dir": ".asv/env",
|
|
47
|
+
"results_dir": ".asv/results",
|
|
48
|
+
"html_dir": ".asv/html"
|
|
49
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Performance benchmarks
|
|
2
|
+
|
|
3
|
+
Run from the repository root with Python 3.12.
|
|
4
|
+
|
|
5
|
+
## Run locally
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Register this machine, then validate the working tree without saving timings.
|
|
9
|
+
uv run --group benchmark -p 3.12 asv machine --yes
|
|
10
|
+
uv run --group benchmark -p 3.12 asv run --python=same --quick --show-stderr --dry-run
|
|
11
|
+
|
|
12
|
+
# Compare committed revisions using the current benchmark suite.
|
|
13
|
+
uv run --group benchmark -p 3.12 asv continuous HEAD~1 HEAD
|
|
14
|
+
|
|
15
|
+
# Record history and view the dashboard.
|
|
16
|
+
uv run --group benchmark -p 3.12 asv run 'main~10..main' --record-samples
|
|
17
|
+
uv run --group benchmark -p 3.12 asv publish
|
|
18
|
+
uv run --group benchmark -p 3.12 asv preview
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use `--bench bench_pytest` to select pytest sessions. Historical runs ignore
|
|
22
|
+
uncommitted library changes and require revisions compatible with the suite.
|
|
23
|
+
Keep the machine and environment consistent; back up `.asv/results/`, which is
|
|
24
|
+
ignored by Git.
|
|
25
|
+
|
|
26
|
+
## What is measured
|
|
27
|
+
|
|
28
|
+
- **27 first-use comparison cases:** nine shapes (scalar, text, small/large
|
|
29
|
+
schemas, spans, matchers, dataclasses, errors, Pydantic models), each with
|
|
30
|
+
active snapshots, disabled snapshots, and plain equality. ASV `timeraw`
|
|
31
|
+
starts a fresh Python process for every sample, with no snapshot warmup.
|
|
32
|
+
Each timing is **ten assertions**, executed once at distinct snapshot call
|
|
33
|
+
sites in one file. It includes the first source read, AST processing, inline
|
|
34
|
+
expected-value construction, and final correctness checks. Later assertions
|
|
35
|
+
in the batch can naturally reuse the file's source cache. Process startup,
|
|
36
|
+
imports, fixture loading, actual-value construction, and cleanup are outside
|
|
37
|
+
timing. This is a cold start of snapshot processing, not of the OS file cache.
|
|
38
|
+
- **Five pytest sessions:** active, disabled, create, fix, and update. Each runs
|
|
39
|
+
ten tests in a fresh process, including startup, reporting, and source edits.
|
|
40
|
+
- **Retained snapshot state:** the recursive size of the session snapshot registry
|
|
41
|
+
after evaluating 100 distinct active scalar call sites. Each call frame has an
|
|
42
|
+
unrelated 100 kB local payload, exposing accidental frame retention.
|
|
43
|
+
|
|
44
|
+
Workloads live in `_workloads.py`; `_fixtures.py` creates distinct call sites.
|
|
45
|
+
Keep expected values inline and increment `SUITE_VERSION` in `_fixtures.py`
|
|
46
|
+
when fixtures, helpers, or timing boundaries change.
|
|
47
|
+
|
|
48
|
+
## PR reports
|
|
49
|
+
|
|
50
|
+
CI measures the PR base and head on the same runner, then uploads raw results
|
|
51
|
+
and the comparison as `benchmark-results`. A separate workflow uses
|
|
52
|
+
[asv-perch](https://github.com/HaoZeke/asv-perch) to post the report, including for
|
|
53
|
+
fork PRs. Performance regressions are informational; benchmark errors fail CI.
|
|
54
|
+
Shared runners are noisy, so small timing differences need confirmation.
|
|
55
|
+
|
|
56
|
+
The commenting workflow becomes active once `benchmark-report.yml` is on the
|
|
57
|
+
default branch. See the [ASV guide](https://asv.readthedocs.io/en/stable/using.html)
|
|
58
|
+
for more commands.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Benchmarks derived from common downstream snapshot usage."""
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Build real source files with distinct snapshot call sites outside timing.
|
|
2
|
+
|
|
3
|
+
Bump SUITE_VERSION whenever fixtures or timing boundaries change: ASV cannot
|
|
4
|
+
hash imported helpers.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import ast
|
|
8
|
+
import importlib.util
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
from ._workloads import comparison_template
|
|
12
|
+
from ._workloads import session_template
|
|
13
|
+
|
|
14
|
+
SUITE_VERSION = "4"
|
|
15
|
+
BATCH_SIZE = 10
|
|
16
|
+
CASES = [
|
|
17
|
+
"scalar",
|
|
18
|
+
"text",
|
|
19
|
+
"schema",
|
|
20
|
+
"schema_large",
|
|
21
|
+
"spans",
|
|
22
|
+
"matchers",
|
|
23
|
+
"events",
|
|
24
|
+
"errors",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def expand_call_sites(source, count):
|
|
29
|
+
"""Repeat the template's test function, preserving literal source syntax.
|
|
30
|
+
|
|
31
|
+
A loop calling one function would reuse a single snapshot call site.
|
|
32
|
+
"""
|
|
33
|
+
function = next(
|
|
34
|
+
node
|
|
35
|
+
for node in ast.parse(source).body
|
|
36
|
+
if isinstance(node, ast.FunctionDef) and node.name == "test_snapshot"
|
|
37
|
+
)
|
|
38
|
+
lines = source.splitlines(keepends=True)
|
|
39
|
+
start, end = function.lineno - 1, function.end_lineno
|
|
40
|
+
body = "".join(lines[start + 1 : end])
|
|
41
|
+
functions = [f"def test_snapshot_{i}():\n{body}\n" for i in range(count)]
|
|
42
|
+
return "".join(lines[:start]) + "\n".join(functions) + "".join(lines[end:])
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def source(case, *, count=BATCH_SIZE):
|
|
46
|
+
return expand_call_sites(comparison_template(case), count)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def pytest_source(mode, *, count=BATCH_SIZE):
|
|
50
|
+
return expand_call_sites(session_template(mode), count)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def snapshot_functions(module):
|
|
54
|
+
return [getattr(module, f"test_snapshot_{i}") for i in range(BATCH_SIZE)]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def load_module(path):
|
|
58
|
+
name = "_inline_snapshot_benchmark_fixture"
|
|
59
|
+
spec = importlib.util.spec_from_file_location(name, path)
|
|
60
|
+
module = importlib.util.module_from_spec(spec)
|
|
61
|
+
# Dataclasses inspect sys.modules when resolving annotations.
|
|
62
|
+
sys.modules[name] = module
|
|
63
|
+
spec.loader.exec_module(module)
|
|
64
|
+
return module
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"""Readable workload templates and deterministic data for large literals.
|
|
2
|
+
|
|
3
|
+
Expected values are rendered inline, so their construction and snapshot source
|
|
4
|
+
processing remain part of the measured assertion.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pprint import pformat
|
|
8
|
+
from string import Template
|
|
9
|
+
|
|
10
|
+
from dirty_equals import IsInt
|
|
11
|
+
from dirty_equals import IsStr
|
|
12
|
+
|
|
13
|
+
SCALAR = """\
|
|
14
|
+
from inline_snapshot import snapshot
|
|
15
|
+
|
|
16
|
+
ACTUAL = 42
|
|
17
|
+
|
|
18
|
+
def test_snapshot():
|
|
19
|
+
assert ACTUAL == snapshot(42)
|
|
20
|
+
|
|
21
|
+
def plain():
|
|
22
|
+
assert ACTUAL == 42
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
MATCHING = Template("""\
|
|
26
|
+
$preamble
|
|
27
|
+
from inline_snapshot import snapshot
|
|
28
|
+
|
|
29
|
+
ACTUAL = $actual
|
|
30
|
+
# Avoid interned strings turning equality into an identity check.
|
|
31
|
+
if isinstance(ACTUAL, str):
|
|
32
|
+
ACTUAL = ACTUAL.encode().decode()
|
|
33
|
+
|
|
34
|
+
def test_snapshot():
|
|
35
|
+
assert ACTUAL == snapshot($expected)
|
|
36
|
+
|
|
37
|
+
def plain():
|
|
38
|
+
assert ACTUAL == $expected
|
|
39
|
+
""")
|
|
40
|
+
|
|
41
|
+
DATACLASSES = """\
|
|
42
|
+
from dataclasses import dataclass
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class Part:
|
|
46
|
+
content: str
|
|
47
|
+
|
|
48
|
+
@dataclass
|
|
49
|
+
class Event:
|
|
50
|
+
index: int
|
|
51
|
+
part: Part
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
MODELS = """\
|
|
55
|
+
from pydantic import BaseModel
|
|
56
|
+
|
|
57
|
+
class Part(BaseModel):
|
|
58
|
+
content: str
|
|
59
|
+
|
|
60
|
+
class Event(BaseModel):
|
|
61
|
+
index: int
|
|
62
|
+
part: Part
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
CREATE = Template("""\
|
|
66
|
+
from inline_snapshot import snapshot
|
|
67
|
+
|
|
68
|
+
ACTUAL = $schema
|
|
69
|
+
|
|
70
|
+
def test_snapshot():
|
|
71
|
+
assert ACTUAL == snapshot()
|
|
72
|
+
""")
|
|
73
|
+
|
|
74
|
+
FIX = Template("""\
|
|
75
|
+
from inline_snapshot import snapshot
|
|
76
|
+
|
|
77
|
+
ACTUAL = $schema
|
|
78
|
+
|
|
79
|
+
def test_snapshot():
|
|
80
|
+
assert ACTUAL == snapshot(None)
|
|
81
|
+
""")
|
|
82
|
+
|
|
83
|
+
UPDATE = """\
|
|
84
|
+
from inline_snapshot import snapshot
|
|
85
|
+
|
|
86
|
+
ACTUAL = [1, 2, 3]
|
|
87
|
+
|
|
88
|
+
def test_snapshot():
|
|
89
|
+
assert ACTUAL == snapshot([1.0, 2.0, 3.0])
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def schema(path_count):
|
|
94
|
+
value = {
|
|
95
|
+
"openapi": "3.1.0",
|
|
96
|
+
"info": {"title": "Benchmark API", "version": "1.0"},
|
|
97
|
+
"paths": {
|
|
98
|
+
f"/items/{i}": {
|
|
99
|
+
"get": {
|
|
100
|
+
"operationId": f"read_item_{i}",
|
|
101
|
+
"parameters": [
|
|
102
|
+
{
|
|
103
|
+
"name": "id",
|
|
104
|
+
"in": "path",
|
|
105
|
+
"required": True,
|
|
106
|
+
"schema": {"type": "integer"},
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"responses": {
|
|
110
|
+
"200": {
|
|
111
|
+
"description": "Success",
|
|
112
|
+
"content": {
|
|
113
|
+
"application/json": {
|
|
114
|
+
"schema": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"properties": {
|
|
117
|
+
"name": {"type": "string"},
|
|
118
|
+
"tags": {
|
|
119
|
+
"type": "array",
|
|
120
|
+
"items": {"type": "string"},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
for i in range(path_count)
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
return value
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def spans(*, matchers=False):
|
|
137
|
+
value = [
|
|
138
|
+
{
|
|
139
|
+
"name": IsStr() if matchers else f"request-{i}",
|
|
140
|
+
"context": {"trace_id": i, "span_id": i + 1},
|
|
141
|
+
"parent": None,
|
|
142
|
+
"start_time": IsInt() if matchers else 1000 + i,
|
|
143
|
+
"attributes": {
|
|
144
|
+
"method": "GET",
|
|
145
|
+
"status": 200,
|
|
146
|
+
"tags": ["http", "server"],
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
for i in range(20)
|
|
150
|
+
]
|
|
151
|
+
return value
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def errors():
|
|
155
|
+
value = [
|
|
156
|
+
{
|
|
157
|
+
"type": "greater_than",
|
|
158
|
+
"loc": ("items", i, "value"),
|
|
159
|
+
"msg": "Input should be greater than 10",
|
|
160
|
+
"input": i,
|
|
161
|
+
"ctx": {"gt": 10},
|
|
162
|
+
}
|
|
163
|
+
for i in range(5)
|
|
164
|
+
]
|
|
165
|
+
return value
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def literal(value):
|
|
169
|
+
return pformat(value, sort_dicts=False)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def comparison_template(case):
|
|
173
|
+
if case == "scalar":
|
|
174
|
+
return SCALAR
|
|
175
|
+
|
|
176
|
+
preamble = ""
|
|
177
|
+
if case == "text":
|
|
178
|
+
actual = expected = literal(
|
|
179
|
+
"\n".join(f"event {i}: completed request successfully" for i in range(100))
|
|
180
|
+
)
|
|
181
|
+
elif case in {"schema", "schema_large"}:
|
|
182
|
+
actual = expected = literal(schema(3 if case == "schema" else 200))
|
|
183
|
+
elif case in {"spans", "matchers"}:
|
|
184
|
+
actual = literal(spans())
|
|
185
|
+
expected = literal(spans(matchers=case == "matchers"))
|
|
186
|
+
preamble = "from dirty_equals import IsInt\nfrom dirty_equals import IsStr\n"
|
|
187
|
+
elif case in {"events", "models"}:
|
|
188
|
+
preamble = DATACLASSES if case == "events" else MODELS
|
|
189
|
+
actual = expected = (
|
|
190
|
+
"[\n"
|
|
191
|
+
+ ",\n".join(
|
|
192
|
+
f"Event(index={i}, part=Part(content='chunk {i}'))" for i in range(50)
|
|
193
|
+
)
|
|
194
|
+
+ "\n]"
|
|
195
|
+
)
|
|
196
|
+
elif case == "errors":
|
|
197
|
+
actual = expected = literal(errors())
|
|
198
|
+
else:
|
|
199
|
+
raise ValueError(case)
|
|
200
|
+
return MATCHING.substitute(preamble=preamble, actual=actual, expected=expected)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def session_template(mode):
|
|
204
|
+
if mode in {"active", "disabled"}:
|
|
205
|
+
return comparison_template("schema")
|
|
206
|
+
if mode == "create":
|
|
207
|
+
return CREATE.substitute(schema=literal(schema(3)))
|
|
208
|
+
if mode == "fix":
|
|
209
|
+
return FIX.substitute(schema=literal(schema(3)))
|
|
210
|
+
if mode == "update":
|
|
211
|
+
return UPDATE
|
|
212
|
+
raise ValueError(mode)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""Fresh-process pytest timings, including startup, reporting and source edits."""
|
|
2
|
+
|
|
3
|
+
import ast
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from tempfile import TemporaryDirectory
|
|
9
|
+
|
|
10
|
+
from ._fixtures import BATCH_SIZE
|
|
11
|
+
from ._fixtures import SUITE_VERSION
|
|
12
|
+
from ._fixtures import pytest_source
|
|
13
|
+
from ._fixtures import snapshot_functions
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PytestSession:
|
|
17
|
+
version = SUITE_VERSION
|
|
18
|
+
params = ["active", "disabled", "create", "fix", "update"]
|
|
19
|
+
param_names = ["mode"]
|
|
20
|
+
number = 1
|
|
21
|
+
warmup_time = 0
|
|
22
|
+
repeat = 3
|
|
23
|
+
rounds = 2
|
|
24
|
+
timeout = 120
|
|
25
|
+
|
|
26
|
+
def setup(self, mode):
|
|
27
|
+
self.directory = TemporaryDirectory()
|
|
28
|
+
self.root = Path(self.directory.name)
|
|
29
|
+
# Ignore user/project pytest settings and explicitly enable our plugin.
|
|
30
|
+
(self.root / "pytest.ini").write_text("[pytest]\n", encoding="utf-8")
|
|
31
|
+
self.path = self.root / "test_workload.py"
|
|
32
|
+
self.original = pytest_source(mode)
|
|
33
|
+
self.path.write_text(self.original, encoding="utf-8")
|
|
34
|
+
(self.root / "conftest.py").write_text(
|
|
35
|
+
"from inline_snapshot._global_state import state\n"
|
|
36
|
+
"def pytest_sessionfinish(session):\n"
|
|
37
|
+
f" assert state().active is {mode != 'disabled'}\n",
|
|
38
|
+
encoding="utf-8",
|
|
39
|
+
)
|
|
40
|
+
self.env = dict(os.environ)
|
|
41
|
+
for key in (
|
|
42
|
+
"PYTEST_ADDOPTS",
|
|
43
|
+
"PYTEST_PLUGINS",
|
|
44
|
+
"PYTHONPATH",
|
|
45
|
+
"INLINE_SNAPSHOT_DEFAULT_FLAGS",
|
|
46
|
+
):
|
|
47
|
+
self.env.pop(key, None)
|
|
48
|
+
self.env.update(
|
|
49
|
+
PYTEST_DISABLE_PLUGIN_AUTOLOAD="1",
|
|
50
|
+
PYTHONHASHSEED="0",
|
|
51
|
+
COLUMNS="100",
|
|
52
|
+
NO_COLOR="1",
|
|
53
|
+
)
|
|
54
|
+
flag = (
|
|
55
|
+
"short-report"
|
|
56
|
+
if mode == "active"
|
|
57
|
+
else "disable" if mode == "disabled" else mode
|
|
58
|
+
)
|
|
59
|
+
self.command = [
|
|
60
|
+
sys.executable,
|
|
61
|
+
"-m",
|
|
62
|
+
"pytest",
|
|
63
|
+
"-p",
|
|
64
|
+
"inline_snapshot.pytest_plugin",
|
|
65
|
+
"-c",
|
|
66
|
+
"pytest.ini",
|
|
67
|
+
"--color=no",
|
|
68
|
+
"-q",
|
|
69
|
+
f"--inline-snapshot={flag}",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
def time_session(self, mode):
|
|
73
|
+
self.result = subprocess.run(
|
|
74
|
+
self.command,
|
|
75
|
+
cwd=self.root,
|
|
76
|
+
env=self.env,
|
|
77
|
+
capture_output=True,
|
|
78
|
+
text=True,
|
|
79
|
+
timeout=60,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
def teardown(self, mode):
|
|
83
|
+
try:
|
|
84
|
+
result = self.result
|
|
85
|
+
output = result.stdout + result.stderr
|
|
86
|
+
# Creation/fixing deliberately reports the original failing tests.
|
|
87
|
+
assert result.returncode == (1 if mode in {"create", "fix"} else 0), output
|
|
88
|
+
assert f"{BATCH_SIZE} passed" in output, output
|
|
89
|
+
if mode in {"create", "fix"}:
|
|
90
|
+
assert f"{BATCH_SIZE} errors" in output, output
|
|
91
|
+
rewritten = self.path.read_text(encoding="utf-8")
|
|
92
|
+
changed = rewritten != self.original
|
|
93
|
+
assert changed == (mode in {"create", "fix", "update"}), output
|
|
94
|
+
if mode == "update":
|
|
95
|
+
values = [
|
|
96
|
+
ast.literal_eval(node.args[0])
|
|
97
|
+
for node in ast.walk(ast.parse(rewritten))
|
|
98
|
+
if isinstance(node, ast.Call)
|
|
99
|
+
and isinstance(node.func, ast.Name)
|
|
100
|
+
and node.func.id == "snapshot"
|
|
101
|
+
]
|
|
102
|
+
assert values == [[1, 2, 3]] * BATCH_SIZE, output
|
|
103
|
+
# Equality alone accepts floats and misses incomplete updates.
|
|
104
|
+
assert all(
|
|
105
|
+
type(item) is int for value in values for item in value
|
|
106
|
+
), output
|
|
107
|
+
if changed:
|
|
108
|
+
# A fast no-rewriting check validates the resulting expected values.
|
|
109
|
+
from inline_snapshot._global_state import snapshot_env
|
|
110
|
+
|
|
111
|
+
from ._fixtures import load_module
|
|
112
|
+
|
|
113
|
+
with snapshot_env() as state:
|
|
114
|
+
state.active = False
|
|
115
|
+
module = load_module(self.path)
|
|
116
|
+
for function in snapshot_functions(module):
|
|
117
|
+
function()
|
|
118
|
+
finally:
|
|
119
|
+
self.directory.cleanup()
|