summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY.md11
-rw-r--r--TODO.md10
-rw-r--r--pystache/__init__.py2
-rw-r--r--pystache/parser.py4
-rw-r--r--pystache/tests/common.py6
-rw-r--r--pystache/tests/main.py1
-rw-r--r--setup.py7
-rw-r--r--setup_description.rst12
-rwxr-xr-xtest_pystache.sh11
-rw-r--r--tox.ini10
10 files changed, 61 insertions, 13 deletions
diff --git a/HISTORY.md b/HISTORY.md
index e5b7638..4eee2e6 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -3,6 +3,17 @@ History
**Note:** Official support for Python 2.4 will end with Pystache version 0.6.0.
+0.6.0 (TBD)
+-----------
+
+- Added [`PYTHONHASHSEED`](http://docs.python.org/using/cmdline.html#envvar-PYTHONHASHSEED)
+ to the test output.
+- Added `test_pystache.sh` wrapper script for testing different
+ PYTHONHASHSEED values.
+- Set PYTHONHASHSEED to "random" when running tox.
+- Bugfix: fixed a flaky doctest by making `repr()` deterministic for the
+ `Attachable` class in `pystache.tests.common`
+
0.5.4 (2014-07-11)
------------------
diff --git a/TODO.md b/TODO.md
index cd82417..d0b13c4 100644
--- a/TODO.md
+++ b/TODO.md
@@ -3,14 +3,16 @@ TODO
In development branch:
-* Figure out a way to suppress center alignment of images in reST output.
+* Randomize PYTHONHASHSEED when running tests in tox.
+* Randomize PYTHONHASHSEED when running tests in Travis CI.
* Add a unit test for the change made in 7ea8e7180c41. This is with regard
to not requiring spec tests when running tests from a downloaded sdist.
-* End support for Python 2.4.
-* Add Python 3.3 to tox file (after deprecating 2.4).
+* Finish removing references to Python 2.4 and noting end of support.
+* In the README, state which version of tox is expected.
+* Look into bypassing the _PartialNode class so that partials can be loaded
+ and parsed at parse-time instead of at render-time.
* Turn the benchmarking script at pystache/tests/benchmark.py into a command
in pystache/commands, or make it a subcommand of one of the existing
commands (i.e. using a command argument).
* Provide support for logging in at least one of the commands.
-* Make sure command parsing to pystache-test doesn't break with Python 2.4 and earlier.
* Combine pystache-test with the main command.
diff --git a/pystache/__init__.py b/pystache/__init__.py
index 4cf2434..ff3150f 100644
--- a/pystache/__init__.py
+++ b/pystache/__init__.py
@@ -10,4 +10,4 @@ from pystache.init import parse, render, Renderer, TemplateSpec
__all__ = ['parse', 'render', 'Renderer', 'TemplateSpec']
-__version__ = '0.5.4' # Also change in setup.py.
+__version__ = '0.6.0-alpha' # Also change in setup.py.
diff --git a/pystache/parser.py b/pystache/parser.py
index 9a4fba2..aa7190f 100644
--- a/pystache/parser.py
+++ b/pystache/parser.py
@@ -12,7 +12,7 @@ from pystache.parsed import ParsedTemplate
END_OF_LINE_CHARACTERS = [u'\r', u'\n']
-NON_BLANK_RE = re.compile(ur'^(.)', re.M)
+NON_BLANK_RE = re.compile(u'^(.)', re.M)
# TODO: add some unit tests for this.
@@ -147,7 +147,7 @@ class _PartialNode(object):
def render(self, engine, context):
template = engine.resolve_partial(self.key)
# Indent before rendering.
- template = re.sub(NON_BLANK_RE, self.indent + ur'\1', template)
+ template = re.sub(NON_BLANK_RE, self.indent + u'\\1', template)
return engine.render(template, context)
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())))
diff --git a/pystache/tests/main.py b/pystache/tests/main.py
index 8af6b2e..eefeca2 100644
--- a/pystache/tests/main.py
+++ b/pystache/tests/main.py
@@ -89,6 +89,7 @@ def main(sys_argv):
"""
# TODO: use logging module
print "pystache: running tests: argv: %s" % repr(sys_argv)
+ print "pystache: PYTHONHASHSEED: %r" % os.getenv('PYTHONHASHSEED')
should_source_exist = False
spec_test_dir = None
diff --git a/setup.py b/setup.py
index 0d99aae..8279bd0 100644
--- a/setup.py
+++ b/setup.py
@@ -52,6 +52,11 @@ Pystache can grant you those permissions.
When you have permissions, run the following:
+ # This uploads the version metadata.
+ # TODO: update our custom publish command to include register.
+ python setup.py register
+
+ # This uploads the *.tar.gz file.
python setup.py publish
If you get an error like the following--
@@ -112,7 +117,7 @@ else:
setup = dist.setup
-VERSION = '0.5.4' # Also change in pystache/__init__.py.
+VERSION = '0.6.0-alpha' # Also change in pystache/__init__.py.
FILE_ENCODING = 'utf-8'
diff --git a/setup_description.rst b/setup_description.rst
index 724c457..4be7aae 100644
--- a/setup_description.rst
+++ b/setup_description.rst
@@ -318,6 +318,18 @@ History
**Note:** Official support for Python 2.4 will end with Pystache version
0.6.0.
+0.6.0 (TBD)
+-----------
+
+- Added
+ ```PYTHONHASHSEED`` <http://docs.python.org/using/cmdline.html#envvar-PYTHONHASHSEED>`__
+ to the test output.
+- Added ``test_pystache.sh`` wrapper script for testing different
+ PYTHONHASHSEED values.
+- Set PYTHONHASHSEED to "random" when running tox.
+- Bugfix: fixed a flaky doctest by making ``repr()`` deterministic for
+ the ``Attachable`` class in ``pystache.tests.common``
+
0.5.4 (2014-07-11)
------------------
diff --git a/test_pystache.sh b/test_pystache.sh
new file mode 100755
index 0000000..4d4cfcb
--- /dev/null
+++ b/test_pystache.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This wrapper script is useful for running tests with different
+# PYTHONHASHSEED values.
+#
+# Sample usage:
+#
+# $ ./test_pystache.sh [ARGS]
+#
+export PYTHONHASHSEED=$RANDOM
+python test_pystache.py "$@"
diff --git a/tox.ini b/tox.ini
index d1eaebf..a539a37 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,9 +3,8 @@
# http://pypi.python.org/pypi/tox
#
[tox]
-# Tox 1.4 drops py24 and adds py33. In the current version, we want to
-# support 2.4, so we can't simultaneously support 3.3.
-envlist = py24,py25,py26,py27,py27-yaml,py27-noargs,py31,py32,pypy
+# Tox stopped supporting py24 as of version 1.4.
+envlist = py25,py26,py27,py27-yaml,py27-noargs,py31,py32,py33,pypy
[testenv]
# Change the working directory so that we don't import the pystache located
@@ -14,6 +13,11 @@ changedir =
{envbindir}
commands =
pystache-test {toxinidir}
+setenv =
+ # TODO: pass in an explicit random value so that we can display the
+ # value when running tests. We can probably do this by having tox
+ # call a wrapper shell script.
+ PYTHONHASHSEED = random
# Check that the spec tests work with PyYAML.
[testenv:py27-yaml]