[Zope-dev] Lessons from zope.testrunner
Marius Gedminas
marius at gedmin.as
Mon Feb 11 18:53:16 UTC 2013
I didn't port zope.testrunner to Python 3, but I did make its tests pass
(eventually) on 3.2 and 3.3.
- If python setup.py test passes, and tox -e py27 passes, and detox
indicates that all Python versions also pass all tests --- that might
just mean you have a bug in your setup.py that doesn't do sys.exit(1)
in case of failures. Oops.
- Python guarantees that random.random() will return the same sequence
of floats if you initialize the RNG with the same seed. This
guarantee doesn't extend to methods like random.shuffle()!
Workaround: random.shuffle(a_list, random.random)
Note: I'm talking about numeric seeds here. If you use strings as
seeds, you'll also have to deal with the different hashing methods:
Python 2.x uses hash(your_string), which is already non-portable
between 32-bit and 64-bit platforms, while Python 3.2+ uses SHA-512,
unless you do random.seed(your_seed, version=1). Anyway, don't use
strings as seeds (because 32-/64-bit nonportability of string hashes).
Marius Gedminas
--
http://pov.lt/ -- Zope 3/BlueBream consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.zope.org/pipermail/zope-dev/attachments/20130211/ee8cd105/attachment.sig>
More information about the Zope-Dev
mailing list