On Sat, Jun 23, 2012 at 10:32 PM, Aaron Meurer <[email protected]> wrote: > Hi everyone. > > I just merged pull request https://github.com/sympy/sympy/pull/1379, > which enables hash randomization by default in the test runner. What > this means is that if you are running Python 2.6.8, 2.7.3, 3.2.3, or > 3.3, then you are going to start seeing a lot of test failures. Hash > randomization randomizes the hash values of strings, which results in > random hash values of all SymPy objects. Because we still rely on > hash values for ordering in a lot of places, this means that there are > a lot of failures when it is enabled. > > In order to facilitate sane testing with this, hash randomization is > seeded. However, the only way to seed it is to set the environment > variable PYTHONHASHSEED before starting Python. Therefore, when the > tests are run in one of the above Python versions, they are not run in > a separate subprocess. If this is a problem for anyone, or if you > desire to disable hash randomization, you can run the tests with > ./bin/test --no-subprocess or ./bin/doctest --no-subprocess. Note > that in all Python versions after 3.3 it will be enabled by default. > > So here are some important things to remember: > > - The test and doctest headers now looks like this: > > ============================= test process starts > ============================== > executable: /usr/bin/python3 (3.2.3-candidate-2) > architecture: 64-bit > cache: yes > ground types: python > random seed: 45250937 > hash randomization: on (PYTHONHASHSEED=61944319) > > Notice the new item at the bottom, "hash randomization". The seed is > given there too. If hash randomization is not supported (e.g., in > Python 2.5), it will say "hash randomization: off".
P.S. The Travis CI says "hash randomization: off", so that means that the Python executable there doesn't support "-R" yet, right? They have version 2.7.2+. > > - To run the tests with a specific seed, set the environment variable, like > > $ PYTHONHASHSEED=61944319 python bin/test > > - Note that the tests and doctests are run in separate subprocesses > with separate seeds with setup.py test. > > - To reproduce failures, you need both the same seed *and* the same > architecture (32-bit or 64-bit), because both are used to compute hash > values. > > - Finally, there is a pretty bad bug with some seeds where test_expand > hangs. We should put priority on this, but until then, you may want > to run the tests with --timeout=60 to timeout any test that runs for > longer than a minute. > > Let's keep a log of all failures and seeds that can reproduce them at > http://code.google.com/p/sympy/issues/detail?id=3272 (or if it would > be easier, we could start a wiki page for them). Any help fixing any > of these problems would be greatly appreciated. We cannot release > until they are all fixed (and conversely, once they are all fixed, we > should be able to get a release candidate out almost right away). > Hopefully we won't have to resort to any XFAILing. > > And lastly, if anyone has any thoughts on how we could canonically > order the arguments of Add and Mul independent of hash values, but is > still just as fast as hash values, I would love to hear it. If we > could do that, it would make fixing these errors a lot easier (on the > other hand, maybe we would be better off design-wise if we made > everything .arg ordering agnostic). I think that the fastest and simplest is to simply use native Python data types like dictionaries, and those will depend on the hash. The final results should not depend on the hash, for example in printing we are simply sorting it. One problem is the usage of .args to access the individual terms in Add and Mul. If those depend on the hash, then I guess one should not really access it directly, except for some quick prototyping in ipython. I just sent an email to the list with the subject "Testing: differences between platforms", not realizing that you already took care of this. Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
