Lessons from zope.testrunner

Marius Gedminas <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <20130211185316.GA29667@platonas>
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

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
signature.asc (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iD8DBQFRGT4ckVdEXeem148RAr5tAJ9Qnr9LnUNqm/ZVD/An/3BRCPt3EACfasdr
rR8BAvVV3pMGNK5EZINZogA=
=X1lx
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.