pytest-strategies 4.1.1__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.
Files changed (173) hide show
  1. pytest_strategies-4.1.1/.github/workflows/release.yml +117 -0
  2. pytest_strategies-4.1.1/.github/workflows/tests.yml +248 -0
  3. pytest_strategies-4.1.1/CHANGELOG.md +514 -0
  4. pytest_strategies-4.1.1/LICENSE +21 -0
  5. pytest_strategies-4.1.1/MANIFEST.in +7 -0
  6. pytest_strategies-4.1.1/PKG-INFO +1068 -0
  7. pytest_strategies-4.1.1/README.md +1028 -0
  8. pytest_strategies-4.1.1/benchmarks/bench.py +347 -0
  9. pytest_strategies-4.1.1/docs/dev.md +2012 -0
  10. pytest_strategies-4.1.1/examples/enum_example.py +271 -0
  11. pytest_strategies-4.1.1/examples/rng_example.py +103 -0
  12. pytest_strategies-4.1.1/examples/sequence_example.py +125 -0
  13. pytest_strategies-4.1.1/examples/strategy_example.py +192 -0
  14. pytest_strategies-4.1.1/examples/test_values_example.py +167 -0
  15. pytest_strategies-4.1.1/pyproject.toml +202 -0
  16. pytest_strategies-4.1.1/setup.cfg +4 -0
  17. pytest_strategies-4.1.1/src/pytest_strategies.egg-info/PKG-INFO +1068 -0
  18. pytest_strategies-4.1.1/src/pytest_strategies.egg-info/SOURCES.txt +171 -0
  19. pytest_strategies-4.1.1/src/pytest_strategies.egg-info/dependency_links.txt +1 -0
  20. pytest_strategies-4.1.1/src/pytest_strategies.egg-info/entry_points.txt +5 -0
  21. pytest_strategies-4.1.1/src/pytest_strategies.egg-info/requires.txt +12 -0
  22. pytest_strategies-4.1.1/src/pytest_strategies.egg-info/top_level.txt +1 -0
  23. pytest_strategies-4.1.1/src/pytest_strategy/__init__.py +212 -0
  24. pytest_strategies-4.1.1/src/pytest_strategy/__main__.py +8 -0
  25. pytest_strategies-4.1.1/src/pytest_strategy/_api.py +259 -0
  26. pytest_strategies-4.1.1/src/pytest_strategy/_cli.py +186 -0
  27. pytest_strategies-4.1.1/src/pytest_strategy/_context.py +563 -0
  28. pytest_strategies-4.1.1/src/pytest_strategy/_encode.py +40 -0
  29. pytest_strategies-4.1.1/src/pytest_strategy/_export.py +414 -0
  30. pytest_strategies-4.1.1/src/pytest_strategy/_factory.py +511 -0
  31. pytest_strategies-4.1.1/src/pytest_strategy/_fingerprint.py +470 -0
  32. pytest_strategies-4.1.1/src/pytest_strategy/_ids.py +253 -0
  33. pytest_strategies-4.1.1/src/pytest_strategy/_introspection.py +141 -0
  34. pytest_strategies-4.1.1/src/pytest_strategy/_options.py +182 -0
  35. pytest_strategies-4.1.1/src/pytest_strategy/_records.py +445 -0
  36. pytest_strategies-4.1.1/src/pytest_strategy/_registry.py +612 -0
  37. pytest_strategies-4.1.1/src/pytest_strategy/_repro.py +615 -0
  38. pytest_strategies-4.1.1/src/pytest_strategy/_resolver.py +887 -0
  39. pytest_strategies-4.1.1/src/pytest_strategy/_reuse.py +692 -0
  40. pytest_strategies-4.1.1/src/pytest_strategy/_runtime.py +518 -0
  41. pytest_strategies-4.1.1/src/pytest_strategy/_streams.py +241 -0
  42. pytest_strategies-4.1.1/src/pytest_strategy/_vector.py +203 -0
  43. pytest_strategies-4.1.1/src/pytest_strategy/_warnings.py +15 -0
  44. pytest_strategies-4.1.1/src/pytest_strategy/hookspecs.py +125 -0
  45. pytest_strategies-4.1.1/src/pytest_strategy/parameters.py +2749 -0
  46. pytest_strategies-4.1.1/src/pytest_strategy/plugin.py +3156 -0
  47. pytest_strategies-4.1.1/src/pytest_strategy/py.typed +0 -0
  48. pytest_strategies-4.1.1/src/pytest_strategy/rng.py +1176 -0
  49. pytest_strategies-4.1.1/src/pytest_strategy/skill/pytest-strategies/SKILL.md +384 -0
  50. pytest_strategies-4.1.1/src/pytest_strategy/skill/pytest-strategies/references/api.md +1173 -0
  51. pytest_strategies-4.1.1/src/pytest_strategy/strategy.py +18 -0
  52. pytest_strategies-4.1.1/src/pytest_strategy/test_args.py +229 -0
  53. pytest_strategies-4.1.1/tests/conftest.py +34 -0
  54. pytest_strategies-4.1.1/tests/golden/export-schema1.json +494 -0
  55. pytest_strategies-4.1.1/tests/golden/names-ids.json +115 -0
  56. pytest_strategies-4.1.1/tests/golden/seed1.json +75 -0
  57. pytest_strategies-4.1.1/tests/golden/values-ids-3.0.json +44 -0
  58. pytest_strategies-4.1.1/tests/integration/FIXTURES_README.md +147 -0
  59. pytest_strategies-4.1.1/tests/integration/README.md +102 -0
  60. pytest_strategies-4.1.1/tests/integration/conftest.py +69 -0
  61. pytest_strategies-4.1.1/tests/integration/strategies.py +236 -0
  62. pytest_strategies-4.1.1/tests/integration/test_constraint_off_integration.py +740 -0
  63. pytest_strategies-4.1.1/tests/integration/test_context_fingerprint_integration.py +499 -0
  64. pytest_strategies-4.1.1/tests/integration/test_context_per_folder_integration.py +669 -0
  65. pytest_strategies-4.1.1/tests/integration/test_deferred_annotations_integration.py +50 -0
  66. pytest_strategies-4.1.1/tests/integration/test_dict_vectors_integration.py +162 -0
  67. pytest_strategies-4.1.1/tests/integration/test_export_schema_integration.py +317 -0
  68. pytest_strategies-4.1.1/tests/integration/test_export_strategies_integration.py +394 -0
  69. pytest_strategies-4.1.1/tests/integration/test_extend_and_details_integration.py +180 -0
  70. pytest_strategies-4.1.1/tests/integration/test_factory_by_object_integration.py +1190 -0
  71. pytest_strategies-4.1.1/tests/integration/test_fix_docs_integration.py +478 -0
  72. pytest_strategies-4.1.1/tests/integration/test_fix_introspection_integration.py +179 -0
  73. pytest_strategies-4.1.1/tests/integration/test_fix_parameters_integration.py +119 -0
  74. pytest_strategies-4.1.1/tests/integration/test_fix_plugin_integration.py +490 -0
  75. pytest_strategies-4.1.1/tests/integration/test_fix_r2-params_integration.py +137 -0
  76. pytest_strategies-4.1.1/tests/integration/test_fix_r2-plugin_integration.py +378 -0
  77. pytest_strategies-4.1.1/tests/integration/test_fix_r2-resolver_integration.py +528 -0
  78. pytest_strategies-4.1.1/tests/integration/test_fix_r3-review_integration.py +272 -0
  79. pytest_strategies-4.1.1/tests/integration/test_fix_resolver_integration.py +318 -0
  80. pytest_strategies-4.1.1/tests/integration/test_fix_rng_integration.py +147 -0
  81. pytest_strategies-4.1.1/tests/integration/test_fixtures_integration.py +287 -0
  82. pytest_strategies-4.1.1/tests/integration/test_full_integration.py +393 -0
  83. pytest_strategies-4.1.1/tests/integration/test_golden_values_integration.py +297 -0
  84. pytest_strategies-4.1.1/tests/integration/test_integration.py +581 -0
  85. pytest_strategies-4.1.1/tests/integration/test_junitxml_integration.py +547 -0
  86. pytest_strategies-4.1.1/tests/integration/test_keyword_only_integration.py +177 -0
  87. pytest_strategies-4.1.1/tests/integration/test_lf_seed_reuse_integration.py +976 -0
  88. pytest_strategies-4.1.1/tests/integration/test_list_strategies_integration.py +242 -0
  89. pytest_strategies-4.1.1/tests/integration/test_named_constraints_integration.py +318 -0
  90. pytest_strategies-4.1.1/tests/integration/test_names_ids_integration.py +443 -0
  91. pytest_strategies-4.1.1/tests/integration/test_nsamples_per_strategy_integration.py +121 -0
  92. pytest_strategies-4.1.1/tests/integration/test_option_names_integration.py +200 -0
  93. pytest_strategies-4.1.1/tests/integration/test_parameter_ids_integration.py +313 -0
  94. pytest_strategies-4.1.1/tests/integration/test_per_sequence_samples_integration.py +130 -0
  95. pytest_strategies-4.1.1/tests/integration/test_plugin_streams_integration.py +1807 -0
  96. pytest_strategies-4.1.1/tests/integration/test_pytest_param_vectors_integration.py +187 -0
  97. pytest_strategies-4.1.1/tests/integration/test_records_integration.py +647 -0
  98. pytest_strategies-4.1.1/tests/integration/test_removed_apis_integration.py +96 -0
  99. pytest_strategies-4.1.1/tests/integration/test_repro_section_integration.py +1138 -0
  100. pytest_strategies-4.1.1/tests/integration/test_row_streams_integration.py +184 -0
  101. pytest_strategies-4.1.1/tests/integration/test_sequence_integration.py +136 -0
  102. pytest_strategies-4.1.1/tests/integration/test_series_integration.py +71 -0
  103. pytest_strategies-4.1.1/tests/integration/test_session_isolation_integration.py +63 -0
  104. pytest_strategies-4.1.1/tests/integration/test_skip_if_empty_integration.py +209 -0
  105. pytest_strategies-4.1.1/tests/integration/test_strategies_ctx_integration.py +1008 -0
  106. pytest_strategies-4.1.1/tests/integration/test_strategy_context_integration.py +344 -0
  107. pytest_strategies-4.1.1/tests/integration/test_strategy_options_integration.py +158 -0
  108. pytest_strategies-4.1.1/tests/integration/test_stream_guard_integration.py +213 -0
  109. pytest_strategies-4.1.1/tests/integration/test_test_values_integration.py +86 -0
  110. pytest_strategies-4.1.1/tests/integration/test_unimported_strategy_files_integration.py +195 -0
  111. pytest_strategies-4.1.1/tests/integration/test_unique_ids_integration.py +295 -0
  112. pytest_strategies-4.1.1/tests/integration/test_v3_features_integration.py +777 -0
  113. pytest_strategies-4.1.1/tests/integration/test_vector_info_integration.py +418 -0
  114. pytest_strategies-4.1.1/tests/integration/test_vector_integration.py +120 -0
  115. pytest_strategies-4.1.1/tests/integration/test_xdist_check_integration.py +639 -0
  116. pytest_strategies-4.1.1/tests/test_rng.py +901 -0
  117. pytest_strategies-4.1.1/tests/unittests/test_bench.py +162 -0
  118. pytest_strategies-4.1.1/tests/unittests/test_constraint_off.py +553 -0
  119. pytest_strategies-4.1.1/tests/unittests/test_context_fingerprint.py +687 -0
  120. pytest_strategies-4.1.1/tests/unittests/test_dataclass_conversion.py +88 -0
  121. pytest_strategies-4.1.1/tests/unittests/test_deferred_annotations.py +85 -0
  122. pytest_strategies-4.1.1/tests/unittests/test_dict_vectors.py +477 -0
  123. pytest_strategies-4.1.1/tests/unittests/test_export_schema.py +596 -0
  124. pytest_strategies-4.1.1/tests/unittests/test_factory_inputs.py +1098 -0
  125. pytest_strategies-4.1.1/tests/unittests/test_fix_docs.py +732 -0
  126. pytest_strategies-4.1.1/tests/unittests/test_fix_introspection.py +244 -0
  127. pytest_strategies-4.1.1/tests/unittests/test_fix_parameters.py +328 -0
  128. pytest_strategies-4.1.1/tests/unittests/test_fix_plugin.py +324 -0
  129. pytest_strategies-4.1.1/tests/unittests/test_fix_r2-params.py +420 -0
  130. pytest_strategies-4.1.1/tests/unittests/test_fix_r2-plugin.py +399 -0
  131. pytest_strategies-4.1.1/tests/unittests/test_fix_r2-resolver.py +860 -0
  132. pytest_strategies-4.1.1/tests/unittests/test_fix_r3-review.py +677 -0
  133. pytest_strategies-4.1.1/tests/unittests/test_fix_resolver.py +762 -0
  134. pytest_strategies-4.1.1/tests/unittests/test_fix_rng.py +445 -0
  135. pytest_strategies-4.1.1/tests/unittests/test_ids.py +171 -0
  136. pytest_strategies-4.1.1/tests/unittests/test_introspection.py +188 -0
  137. pytest_strategies-4.1.1/tests/unittests/test_keyword_only.py +257 -0
  138. pytest_strategies-4.1.1/tests/unittests/test_metadata_export.py +70 -0
  139. pytest_strategies-4.1.1/tests/unittests/test_named_constraints.py +911 -0
  140. pytest_strategies-4.1.1/tests/unittests/test_names_ids.py +328 -0
  141. pytest_strategies-4.1.1/tests/unittests/test_parameter_extend.py +243 -0
  142. pytest_strategies-4.1.1/tests/unittests/test_parameter_ids.py +358 -0
  143. pytest_strategies-4.1.1/tests/unittests/test_parameters.py +684 -0
  144. pytest_strategies-4.1.1/tests/unittests/test_per_sequence_samples.py +199 -0
  145. pytest_strategies-4.1.1/tests/unittests/test_plugin_streams.py +1684 -0
  146. pytest_strategies-4.1.1/tests/unittests/test_pytest_param_vectors.py +175 -0
  147. pytest_strategies-4.1.1/tests/unittests/test_records.py +801 -0
  148. pytest_strategies-4.1.1/tests/unittests/test_removed_apis.py +158 -0
  149. pytest_strategies-4.1.1/tests/unittests/test_repro.py +951 -0
  150. pytest_strategies-4.1.1/tests/unittests/test_resolver_nsamples.py +230 -0
  151. pytest_strategies-4.1.1/tests/unittests/test_reuse.py +1214 -0
  152. pytest_strategies-4.1.1/tests/unittests/test_rng_enum.py +343 -0
  153. pytest_strategies-4.1.1/tests/unittests/test_row_streams.py +889 -0
  154. pytest_strategies-4.1.1/tests/unittests/test_rows.py +855 -0
  155. pytest_strategies-4.1.1/tests/unittests/test_runtime.py +87 -0
  156. pytest_strategies-4.1.1/tests/unittests/test_sequence.py +118 -0
  157. pytest_strategies-4.1.1/tests/unittests/test_series.py +232 -0
  158. pytest_strategies-4.1.1/tests/unittests/test_skill_docs.py +579 -0
  159. pytest_strategies-4.1.1/tests/unittests/test_skill_install.py +381 -0
  160. pytest_strategies-4.1.1/tests/unittests/test_skip_if_empty.py +164 -0
  161. pytest_strategies-4.1.1/tests/unittests/test_strategy_context.py +1733 -0
  162. pytest_strategies-4.1.1/tests/unittests/test_strategy_options.py +308 -0
  163. pytest_strategies-4.1.1/tests/unittests/test_stream_guard.py +362 -0
  164. pytest_strategies-4.1.1/tests/unittests/test_streams.py +509 -0
  165. pytest_strategies-4.1.1/tests/unittests/test_test_args.py +314 -0
  166. pytest_strategies-4.1.1/tests/unittests/test_test_values.py +101 -0
  167. pytest_strategies-4.1.1/tests/unittests/test_test_values_corner_cases.py +136 -0
  168. pytest_strategies-4.1.1/tests/unittests/test_typing.py +290 -0
  169. pytest_strategies-4.1.1/tests/unittests/test_unimported_strategy_files.py +195 -0
  170. pytest_strategies-4.1.1/tests/unittests/test_v3_features.py +362 -0
  171. pytest_strategies-4.1.1/tests/unittests/test_vector.py +324 -0
  172. pytest_strategies-4.1.1/tests/unittests/test_vector_info.py +594 -0
  173. pytest_strategies-4.1.1/tests/unittests/test_xdist_check.py +486 -0
@@ -0,0 +1,117 @@
1
+ name: Release
2
+
3
+ # Publishes a GitHub Release with the sdist and wheel when a version tag is pushed
4
+ # (git tag -a v2.0.0 -m "pytest-strategies 2.0.0" && git push origin v2.0.0),
5
+ # then uploads the same files to PyPI through trusted publishing (no API token:
6
+ # PyPI trusts this workflow file in the `pypi` environment of this repository).
7
+ # A manual run creates the tag on the selected branch first.
8
+ on:
9
+ push:
10
+ tags: ["v*"]
11
+ workflow_dispatch:
12
+ inputs:
13
+ version:
14
+ description: "Version to release, without the v (must match pyproject.toml)"
15
+ required: true
16
+
17
+ permissions:
18
+ contents: write
19
+
20
+ jobs:
21
+ release:
22
+ name: GitHub Release
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+
27
+ - name: Set up Python
28
+ uses: actions/setup-python@v7
29
+ with:
30
+ python-version: "3.14"
31
+
32
+ - name: Check the version
33
+ env:
34
+ VERSION: ${{ github.event_name == 'push' && github.ref_name || format('v{0}', inputs.version) }}
35
+ run: |
36
+ version="${VERSION#v}"
37
+ project=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
38
+ if [ "$version" != "$project" ]; then
39
+ echo "::error::Tag v$version does not match version $project in pyproject.toml"
40
+ exit 1
41
+ fi
42
+ echo "VERSION=$version" >> "$GITHUB_ENV"
43
+
44
+ - name: Create the tag
45
+ if: github.event_name == 'workflow_dispatch'
46
+ run: |
47
+ git fetch --tags origin
48
+ if git rev-parse -q --verify "refs/tags/v$VERSION" > /dev/null; then
49
+ echo "::error::Tag v$VERSION already exists"
50
+ exit 1
51
+ fi
52
+ git config user.name "github-actions[bot]"
53
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
54
+ git tag -a "v$VERSION" -m "pytest-strategies $VERSION"
55
+ git push origin "v$VERSION"
56
+
57
+ - name: Build
58
+ run: |
59
+ python -m pip install --upgrade pip build twine
60
+ python -m build
61
+ python -m twine check --strict dist/*
62
+
63
+ - name: Keep the files for the PyPI job
64
+ uses: actions/upload-artifact@v7
65
+ with:
66
+ name: dist
67
+ path: dist/
68
+ if-no-files-found: error
69
+
70
+ - name: Test the wheel
71
+ run: |
72
+ python -m venv /tmp/wheel
73
+ /tmp/wheel/bin/pip install dist/*.whl
74
+ cd examples && /tmp/wheel/bin/python -m pytest -p no:cacheprovider -q --rng-seed=1 *.py
75
+
76
+ - name: Release notes from the CHANGELOG
77
+ shell: python
78
+ run: |
79
+ import os, pathlib, re, sys
80
+
81
+ version = os.environ["VERSION"]
82
+ changelog = pathlib.Path("CHANGELOG.md").read_text(encoding="utf-8")
83
+ section = re.search(
84
+ rf"^## \[{re.escape(version)}\][^\n]*\n(.*?)(?=^## \[|^\[[^\]\n]+\]: )",
85
+ changelog,
86
+ re.M | re.S,
87
+ )
88
+ if section is None or not section.group(1).strip():
89
+ sys.exit(f"CHANGELOG.md has no section for {version}")
90
+ pathlib.Path("notes.md").write_text(section.group(1).strip() + "\n", encoding="utf-8")
91
+
92
+ - name: Create the GitHub Release
93
+ env:
94
+ GH_TOKEN: ${{ github.token }}
95
+ run: >
96
+ gh release create "v$VERSION" dist/*
97
+ --verify-tag
98
+ --title "pytest-strategies $VERSION"
99
+ --notes-file notes.md
100
+
101
+ pypi:
102
+ name: PyPI
103
+ needs: release
104
+ runs-on: ubuntu-latest
105
+ environment:
106
+ name: pypi
107
+ url: https://pypi.org/project/pytest-strategies/
108
+ permissions:
109
+ id-token: write
110
+ steps:
111
+ - uses: actions/download-artifact@v8
112
+ with:
113
+ name: dist
114
+ path: dist/
115
+
116
+ - name: Publish to PyPI
117
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,248 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop, migration]
6
+ pull_request:
7
+ branches: [main, develop, migration]
8
+
9
+ jobs:
10
+ test:
11
+ name: Tests (${{ matrix.os }}, py${{ matrix.python-version }}, pytest ${{ matrix.pytest }})
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest]
17
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
18
+ pytest: [latest]
19
+ include:
20
+ # The one coverage run
21
+ - os: ubuntu-latest
22
+ python-version: "3.14"
23
+ pytest: latest
24
+ coverage: true
25
+ # The oldest supported pytest
26
+ - os: ubuntu-latest
27
+ python-version: "3.11"
28
+ pytest: "8.4.2"
29
+ - os: ubuntu-latest
30
+ python-version: "3.14"
31
+ pytest: "8.4.2"
32
+ - os: windows-latest
33
+ python-version: "3.11"
34
+ pytest: latest
35
+ - os: windows-latest
36
+ python-version: "3.14"
37
+ pytest: latest
38
+
39
+ steps:
40
+ - uses: actions/checkout@v7
41
+
42
+ - name: Set up Python ${{ matrix.python-version }}
43
+ uses: actions/setup-python@v7
44
+ with:
45
+ python-version: ${{ matrix.python-version }}
46
+
47
+ - name: Install dependencies
48
+ shell: bash
49
+ run: |
50
+ python -m pip install --upgrade pip
51
+ pip install -e ".[dev]"
52
+ if [ "${{ matrix.pytest }}" != "latest" ]; then
53
+ pip install "pytest==${{ matrix.pytest }}"
54
+ fi
55
+ python -m pytest --version
56
+
57
+ - name: Run the suite
58
+ if: ${{ !matrix.coverage }}
59
+ run: python -m pytest -n auto
60
+
61
+ # coverage run, not pytest-cov: the plugin is imported through its entry
62
+ # point before pytest-cov starts, which would count every module-level
63
+ # line (imports, def and class lines) as missed. One process, no xdist.
64
+ - name: Run the suite with coverage
65
+ if: ${{ matrix.coverage }}
66
+ run: |
67
+ python -m coverage run -m pytest
68
+ python -m coverage report --fail-under=90
69
+
70
+ - name: Run the sequence tests with --nsamples=auto
71
+ run: python -m pytest tests/integration/test_sequence_integration.py --nsamples=auto
72
+
73
+ examples:
74
+ name: Examples, vector modes and xdist
75
+ runs-on: ubuntu-latest
76
+ steps:
77
+ - uses: actions/checkout@v7
78
+
79
+ - name: Set up Python
80
+ uses: actions/setup-python@v7
81
+ with:
82
+ python-version: "3.14"
83
+
84
+ - name: Install dependencies
85
+ run: |
86
+ python -m pip install --upgrade pip
87
+ pip install -e ".[dev]"
88
+
89
+ - name: Examples
90
+ run: python -m pytest examples/*.py
91
+
92
+ - name: Examples with --nsamples=auto
93
+ run: python -m pytest examples/*.py --nsamples=auto
94
+
95
+ - name: Examples with --nsamples=5
96
+ run: python -m pytest examples/*.py --nsamples=5
97
+
98
+ - name: Test vectors only (--vector-mode=test)
99
+ run: python -m pytest examples/test_values_example.py --vector-mode=test
100
+
101
+ # Test IDs name the rows, so a seed changes the values but not the node IDs:
102
+ # the same list for seeds 1 and 2, and under --nsamples=auto, which permutes
103
+ # RNGSequence rows, the same set
104
+ - name: Node IDs do not depend on the seed
105
+ # bash in Actions runs with -o pipefail, so a failing pytest fails the step
106
+ shell: bash
107
+ run: |
108
+ for seed in 1 2; do
109
+ python -m pytest examples/*.py --collect-only -q --rng-seed=$seed | grep "::" > ids-$seed.txt
110
+ python -m pytest examples/*.py --collect-only -q --rng-seed=$seed --nsamples=auto | grep "::" | sort > ids-auto-$seed.txt
111
+ done
112
+ test -s ids-1.txt && test -s ids-auto-1.txt
113
+ diff ids-1.txt ids-2.txt
114
+ diff ids-auto-1.txt ids-auto-2.txt
115
+
116
+ - name: -k selects a directed vector by its name
117
+ shell: bash
118
+ run: |
119
+ python -m pytest examples/*.py --collect-only -q -k zeros | grep "::" > selected.txt
120
+ cat selected.txt
121
+ test "$(cat selected.txt)" = "examples/strategy_example.py::test_addition[directed-zeros]"
122
+
123
+ - name: One random row by its node ID
124
+ shell: bash
125
+ run: python -m pytest "examples/strategy_example.py::test_addition[rand-3]" --rng-seed=1 -q | tee row.txt && grep -q "^1 passed" row.txt
126
+
127
+ - name: Examples with the 3.0 test IDs (-o strategies_ids=values)
128
+ run: python -m pytest examples/*.py -o strategies_ids=values
129
+
130
+ # Started in the rootdir with no path on the command line, so the run collects
131
+ # its testpaths and counts as the whole suite: a name that matches no
132
+ # constraint stops it with a usage error instead of a red line.
133
+ - name: An example with its named constraint turned off (--strategy-constraint-off)
134
+ run: python -m pytest -o testpaths=examples -o python_files=test_values_example.py --strategy-constraint-off=date_range_test:ordered
135
+
136
+ - name: Examples on two xdist workers, without a seed
137
+ run: python -m pytest examples/*.py -n 2
138
+
139
+ - name: Examples on two xdist workers, with a seed
140
+ run: python -m pytest examples/*.py -n 2 --rng-seed=1
141
+
142
+ # The examples' runs above exit with code 4 if their two workers generated
143
+ # different values under the same test IDs. These projects check that on two
144
+ # workers: a context, a list built from a set under two hash seeds, the global
145
+ # random, Series values that change the IDs, and workers that agree
146
+ - name: Workers that generate different vectors fail the run (-n 2)
147
+ run: python -m pytest tests/integration/test_xdist_check_integration.py -v
148
+
149
+ # Informational: timings depend on the runner, so the step prints them and never
150
+ # fails the job. Compare versions by running the script on one machine
151
+ - name: Benchmark (informational)
152
+ continue-on-error: true
153
+ run: python benchmarks/bench.py --sweep --memory
154
+
155
+ packaging:
156
+ name: Packaging
157
+ runs-on: ubuntu-latest
158
+ steps:
159
+ - uses: actions/checkout@v7
160
+
161
+ - name: Set up Python
162
+ uses: actions/setup-python@v7
163
+ with:
164
+ python-version: "3.14"
165
+
166
+ - name: Build and check
167
+ run: |
168
+ python -m pip install --upgrade pip build twine
169
+ python -m build
170
+ python -m twine check --strict dist/*
171
+
172
+ - name: The sdist carries the typing marker and the skill
173
+ run: |
174
+ tar tzf dist/*.tar.gz > sdist.txt
175
+ grep -q "src/pytest_strategy/py.typed$" sdist.txt
176
+ grep -q "src/pytest_strategy/skill/pytest-strategies/SKILL.md$" sdist.txt
177
+ grep -q "src/pytest_strategy/skill/pytest-strategies/references/api.md$" sdist.txt
178
+
179
+ - name: Install the wheel in a clean venv
180
+ run: |
181
+ python -m venv /tmp/wheel
182
+ /tmp/wheel/bin/pip install dist/*.whl
183
+ /tmp/wheel/bin/python - <<'EOF'
184
+ from importlib import resources
185
+ import pytest_strategy
186
+
187
+ assert "site-packages" in pytest_strategy.__file__, pytest_strategy.__file__
188
+ root = resources.files("pytest_strategy")
189
+ for name in ("py.typed", "skill/pytest-strategies/SKILL.md", "skill/pytest-strategies/references/api.md"):
190
+ assert (root / name).is_file(), f"{name} is missing from the wheel"
191
+ print("pytest-strategies", pytest_strategy.__version__, "from", pytest_strategy.__file__)
192
+ EOF
193
+
194
+ - name: Run the examples from the wheel
195
+ working-directory: examples
196
+ run: /tmp/wheel/bin/python -m pytest -p no:cacheprovider -q --rng-seed=1 *.py
197
+
198
+ - name: Install the skill in a project
199
+ run: |
200
+ mkdir /tmp/project && cd /tmp/project
201
+ /tmp/wheel/bin/pytest-strategies skill install --all
202
+ test -f .claude/skills/pytest-strategies/SKILL.md
203
+ test -f .agents/skills/pytest-strategies/SKILL.md
204
+ test -f .agents/skills/pytest-strategies/references/api.md
205
+
206
+ lint:
207
+ name: Lint (ruff + black)
208
+ runs-on: ubuntu-latest
209
+ steps:
210
+ - uses: actions/checkout@v7
211
+
212
+ - name: Set up Python
213
+ uses: actions/setup-python@v7
214
+ with:
215
+ python-version: "3.14"
216
+
217
+ - name: Install dependencies
218
+ run: |
219
+ python -m pip install --upgrade pip
220
+ pip install -e ".[dev]"
221
+
222
+ - name: Ruff
223
+ run: ruff check src/ tests/ benchmarks/
224
+
225
+ - name: Black
226
+ run: black --check src/ tests/ benchmarks/
227
+
228
+ typecheck:
229
+ name: Type check (mypy --strict)
230
+ runs-on: ubuntu-latest
231
+ steps:
232
+ - uses: actions/checkout@v7
233
+
234
+ - name: Set up Python
235
+ uses: actions/setup-python@v7
236
+ with:
237
+ python-version: "3.14"
238
+
239
+ - name: Install dependencies
240
+ run: |
241
+ python -m pip install --upgrade pip
242
+ pip install -e ".[dev]"
243
+
244
+ - name: Mypy
245
+ run: mypy --strict src/pytest_strategy/
246
+
247
+ - name: The decorators keep the decorated function's type
248
+ run: mypy --strict tests/unittests/test_typing.py