summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2013-09-15 09:44:37 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2013-09-15 09:44:37 -0700
commit996d12f384fcde6c7823da1066713e4d83541950 (patch)
tree290eb3dd30399fcdfcd1a22cae6fa5657c82e375
parentf05776adf699afc6dbb865bfc1b9ce69d346c803 (diff)
downloadpystache-996d12f384fcde6c7823da1066713e4d83541950.tar.gz
Fix a flaky doctest.
Make repr() deterministic for the class pystache.tests.common.Attachable added for issue #99.
-rw-r--r--HISTORY.md5
-rw-r--r--pystache/tests/common.py6
2 files changed, 8 insertions, 3 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 1f70335..922d995 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -8,7 +8,10 @@ History
- Added [`PYTHONHASHSEED`](http://docs.python.org/using/cmdline.html#envvar-PYTHONHASHSEED)
to the test output.
-- TODO
+- Added `test_pystache.sh` wrapper script for testing different
+ PYTHONHASHSEED values.
+- Bugfix: fixed a flaky doctest by making `repr()` deterministic for the
+ `Attachable` class in `pystache.tests.common`
0.5.3 (2012-11-03)
------------------
diff --git a/pystache/tests/common.py b/pystache/tests/common.py
index 222e14f..c87e26e 100644
--- a/pystache/tests/common.py
+++ b/pystache/tests/common.py
@@ -232,6 +232,8 @@ class Attachable(object):
setattr(self, arg, value)
def __repr__(self):
+ # Sort self.__args__.iteritems() so that repr() does not depend on
+ # Python's hash seed (e.g. PYTHONHASHSEED).
return "%s(%s)" % (self.__class__.__name__,
- ", ".join("%s=%s" % (k, repr(v))
- for k, v in self.__args__.iteritems()))
+ ", ".join("%s=%s" % (k, repr(v)) for k, v in
+ sorted(self.__args__.iteritems())))