Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #212

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------

Expand Down
10 changes: 6 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion pystache/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

__all__ = ['parse', 'render', 'Renderer', 'TemplateSpec']

__version__ = '0.5.4' # Also change in setup.py.
__version__ = '0.6.0-alpha' # Also change in setup.py.
4 changes: 2 additions & 2 deletions pystache/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


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.
Expand Down Expand Up @@ -147,7 +147,7 @@ def __repr__(self):
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)

Expand Down
6 changes: 4 additions & 2 deletions pystache/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ def __init__(self, **kwargs):
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())))
1 change: 1 addition & 0 deletions pystache/tests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@

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--
Expand Down Expand Up @@ -112,7 +117,7 @@
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'

Expand Down
12 changes: 12 additions & 0 deletions setup_description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------

Expand Down
11 changes: 11 additions & 0 deletions test_pystache.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
10 changes: 7 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down