Add initial Hypothesis config property tests#2144
Conversation
|
Thanks for working on this! This is really useful. I don't think this should be a part of the regular test suite, since it won't behave predictably. We don't want contributors to get failures others won't see. I'd prefer if this was under a separate directory. We could optionally run it as part of the tests, but only if we can prohibit any randomness. |
011fbb1 to
7ecdcec
Compare
|
Thanks, that makes sense. I updated this to keep the property tests out of The regular coverage suite no longer installs the That should keep these useful for parser/serializer coverage without making the regular contributor test run locally variable. |
Follow-up to #2144. The initial Hypothesis config round-trip property exposed a case where quoted trailing whitespace was not preserved when reading config values back. For example, a value like `b" "` is written as a quoted config value, but parsing discarded the whitespace because `_parse_string` buffered whitespace even while inside quotes. This changes `_parse_string` so spaces and tabs inside quotes are preserved immediately, while trailing whitespace outside quotes is still ignored. Also included: - a focused regression test for round-tripping quoted trailing space and tab values - removal of the temporary property-test filter that excluded values ending in space or tab
This adds a small first slice of property-based testing using Hypothesis.
I kept this deliberately small so the dependency, CI behavior, and test style can be reviewed independently from bug fixes or broader property-test expansion.
The goal is to establish a separate property-test shape without changing Dulwich's regular test suite:
tests.test_suiteunchangedunittestrunnerproperty_tests, outside the regular test suiteConfigFilebecause it is pure, fast, and parser/serializer-orientedThe new config property tests cover two things:
write_to_file()andfrom_file()While testing this locally, this already exposed at least one small config round-trip issue. I have kept the fix out of this PR so this first review can stay focused on the Hypothesis setup and initial test shape. I'll send the bug fix separately.
Also included:
.hypothesis/tests.test_suiteentry point