Skip to content
Property-based tests for the Python standard library (and builtins)
Python
Branch: master
Clone or download
Latest commit 191116a Jan 30, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests Lib2to3 tokenize bug Jan 31, 2020
.gitignore Initial commit Dec 31, 2019
.travis.yml Set up travis & tox-based workflow Dec 31, 2019
LICENSE.mpl-2.txt Expand README, add LICENSE Dec 31, 2019
LICENSE.psfl.txt Expand README, add LICENSE Dec 31, 2019
README.md
requirements-dev.in Update deps, add linters Jan 27, 2020
requirements-dev.txt Update deps, add linters Jan 27, 2020
requirements.in Add dateutil extras into testing strategy Jan 30, 2020
requirements.txt Add dateutil extras into testing strategy Jan 30, 2020
tox.ini Pass posargs to unittest Jan 31, 2020

README.md

stdlib-property-tests

Property-based tests for the Python standard library (and builtins)

Goal

Find and fix bugs in Python, before they ship to users.

CPython's existing test suite is good, but bugs still slip through occasionally. We think that using property-based testing tools - i.e. Hypothesis - can help with this. They're no magic bullet, but computer-assisted testing techniques routinely try inputs that humans wouldn't think of (or bother trying), and turn up bugs that humans missed.

Writing tests that describe every valid input often leads to tighter validation and cleaner designs too, even when no counterexamples are found!

We aim to have a compelling proof-of-concept by PyCon US, and be running as part of the CPython CI suite by the end of the sprints.

LICENSE

By contributing to this repository, you agree to license the contributed code under user's choice of the Mozilla Public License Version 2.0, and the Python Software Foundation License Version 2.

This dual-licence is intended to make it as easy as possible for the tests in this repository to be used upstream by the CPython project, other implementations of Python, and the Hypothesis project and ecosystem.

Workflow

To run the tests against the current version of Python:

  • pip install -r requirements.txt (or hypothesis hypothesmith)
  • python -m unittest

For development, we use tox to manage an extensive suite of auto-formatters and linters, so:

  • pip install tox
  • tox

will set up a virtualenv for you, install everything, and finally run the formatters, linters, and test suite.

Contributors

Trophy Case

Bugs found via this specific project:

  • BPO-38953 tokenize.tokenize -> tokenize.untokenize does not round-trip as documented. Nor, for that matter, do the tokenize/untokenize functions in lib2to3.pgen.tokenize.
You can’t perform that action at this time.