Debian Codegraph @

.claude/CLAUDE.md

raw symbols SCIP
1 # Hypothesis Development Guide
2
3 ## Essential Reading
4
5 **Always read `CONTRIBUTING.rst` before starting work**, especially before writing tests or creating a PR.
6
7 ## Testing
8
9 ### Running Tests
10
11 Run tests using the build system:
12 - **Quick test run**: `./build.sh check-coverage` (curated subset with coverage verification)
13 - **Python version-specific**: `./build.sh check-py311` (replace with target version)
14 - **Fine-grained control**: `./build.sh tox py311-custom 3.11.3 -- [pytest args]`
15 - **Direct pytest** (after setup): `pytest hypothesis-python/tests/cover/`
16
17 ### Writing Tests
18
19 **Never use `.example()` method in tests.** Instead:
20 - Use `@given` decorator directly for property-based tests
21 - Use helper functions from `tests.common.debug`:
22 - `minimal()` - find minimal failing example
23 - `find_any()` - find any example matching condition
24 - `assert_all_examples()` - verify all examples match predicate
25 - `assert_simple_property()` - verify simple properties with few examples
26 - `check_can_generate_examples()` - verify strategy can generate without error
27
28 ## Changelog & Pull Requests
29
30 When creating a PR that changes `hypothesis-python/src/`:
31 1. Create `hypothesis-python/RELEASE.rst` with `RELEASE_TYPE: patch` (bugfixes) or `minor` (features)
32 2. See `RELEASE-sample.rst` for examples
33 3. **Imitate the style in `changelog.rst`** for consistency
34 4. Follow all changelog instructions in `CONTRIBUTING.rst`
35
36 **Note:** Test-only changes (no modifications to `src/`) do not require a RELEASE.rst file.
37
38 ## Before Committing
39
40 1. Do a final edit pass on all code to ensure it is:
41 - **Concise** - remove unnecessary verbosity
42 - **Idiomatic** - follows Python and Hypothesis conventions
43 - **Minimally commented** - code should be self-documenting; only add comments where truly needed
44 2. **Run `./build.sh format; ./build.sh lint`** immediately before committing to auto-format and lint code
45 3. **Do not reference issues or PRs in commit messages** (e.g., avoid `Fixes #1234` or `See #5678`) - this clutters the issue timeline with unnecessary links