This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2017-08-10.11:45:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502365539.11.0.343233157276.issue31174@psf.upfronthosting.co.za>
In-reply-to
Content
The "x86 Gentoo Refleaks 3.x" buildbot runs tests using -u-cpu to disable the cpu resource. The problem is that DirectoryTestCase.test_files() of Lib/test/test_tools/test_unparse.py uses random:

        # Test limited subset of files unless the 'cpu' resource is specified.
        if not test.support.is_resource_enabled("cpu"):
            names = random.sample(names, 10)

So when we run the same test 7 times, each run uses different data.

I see different options:

* Reseed random using the same seed in dash_R() of regrtest
* Always test all data in test_unparse.py: all files, or select a specific set of interesting files

The random issue is more generic than just test_unparse.py, and so it would be interesting to explore this path. Maybe the random issue explains why some other tests fail randomly.

libregrtest always seeds the random RNG using a seed displayed on the standard output. We should either reuse this seed, or create a new unique seed for each test file, and display it (to be able to reproduce tests).

Reseed random before running each test file can also helps to make tests more reproductible

--

http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%203.x/builds/52/steps/test/logs/stdio

test_tools leaked [1, 4, 2] memory blocks, sum=7
(...)
Re-running test 'test_tools' in verbose mode
(...)
test_tools leaked [1, 2, 2] memory blocks, sum=5
(...)
1 test failed again:
    test_tools
History
Date User Action Args
2017-08-10 11:45:39vstinnersetrecipients: + vstinner, serhiy.storchaka
2017-08-10 11:45:39vstinnersetmessageid: <1502365539.11.0.343233157276.issue31174@psf.upfronthosting.co.za>
2017-08-10 11:45:39vstinnerlinkissue31174 messages
2017-08-10 11:45:38vstinnercreate