[2.7] bpo-29512, bpo-30764: Backport regrtest enhancements from 3.5 to 2.7 by vstinner · Pull Request #2541 · python/cpython

@vstinner

* bpo-29512: Add test.bisect, bisect failing tests (#2452)

Add a new "python3 -m test.bisect" tool to bisect failing tests.

It can be used to find which test method(s) leak references, leak
files, etc.

* bpo-30764: Fix regrtest --fail-env-changed --forever (#2536) (#2539)

--forever now stops if a fail changes the environment.

@vstinner