Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
f30aad9a
Commit
f30aad9a
authored
Apr 23, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes in preparation for 0.5.1.
parent
e05966ee
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
28 deletions
+57
-28
README.rst
+17
-12
TODO.md
+0
-1
pystache/tests/main.py
+17
-1
pystache/tests/spectesting.py
+10
-2
setup.cfg
+0
-5
setup.py
+3
-6
tox.ini
+10
-1
No files found.
README.rst
View file @
f30aad9a
...
@@ -25,19 +25,20 @@ Requirements
...
@@ -25,19 +25,20 @@ Requirements
Pystache is tested with the following versions of Python:
Pystache is tested with the following versions of Python:
* Python 2.4 (requires
simplejson version 2.0.9
or earlier)
* Python 2.4 (requires
`simplejson version 2.0.9`_
or earlier)
* Python 2.5 (requires simplejson)
* Python 2.5 (requires simplejson
_
)
* Python 2.6
* Python 2.6
* Python 2.7
* Python 2.7
* Python 3.1
* Python 3.2
* Python 3.2
JSON support is needed only for the command-line interface and to run the
JSON support is needed only for the command-line interface and to run the
spec tests. We require simplejson_ for earlier versions of Python since
spec tests. We require simplejson for earlier versions of Python since
Python's json_ module was added in Python 2.6. Moreover, we require an
Python's json_ module was added in Python 2.6.
earlier version of simplejson for Python 2.4 since simplejson stopped
officially supporting Python 2.4 with version 2.1.0.
An earlier version of simplejson can be installed manually, as follows: ::
For Python 2.4 we require an earlier version of simplejson since simplejson
stopped officially supporting Python 2.4 in simplejson version 2.1.0.
Earlier versions of simplejson can be installed manually, as follows: ::
pip install 'simplejson<2.1.0'
pip install 'simplejson<2.1.0'
...
@@ -162,9 +163,11 @@ Mustache spec. To include tests from the Mustache spec in your test runs: ::
...
@@ -162,9 +163,11 @@ Mustache spec. To include tests from the Mustache spec in your test runs: ::
git submodule init
git submodule init
git submodule update
git submodule update
The test harness parses the spec's yaml files if PyYAML_ is present.
Otherwise, it parses the json files.
To test Pystache from a source distribution with Python 3.x, you must use tox.
To test Pystache from a source distribution with Python 3.x, you must use tox.
This is because the raw source is not Python 3 compatible and must first be
This is because the source code must first be run through 2to3_.
run through 2to3_.
Mailing List
Mailing List
...
@@ -183,9 +186,9 @@ Author
...
@@ -183,9 +186,9 @@ Author
::
::
>>> context = { 'author': 'Chris Wanstrath', '
email': 'chris@ozmm.org
' }
>>> context = { 'author': 'Chris Wanstrath', '
maintainer': 'Chris Jerdonek
' }
>>> print pystache.render("{{author}} :: {{
email
}}", context)
>>> print pystache.render("{{author}} :: {{
maintainer
}}", context)
Chris Wanstrath ::
chris@ozmm.org
Chris Wanstrath ::
Chris Jerdonek
.. _2to3: http://docs.python.org/library/2to3.html
.. _2to3: http://docs.python.org/library/2to3.html
...
@@ -202,8 +205,10 @@ Author
...
@@ -202,8 +205,10 @@ Author
.. _only unicode strings: http://docs.python.org/howto/unicode.html#tips-for-writing-unicode-aware-programs
.. _only unicode strings: http://docs.python.org/howto/unicode.html#tips-for-writing-unicode-aware-programs
.. _PyPI: http://pypi.python.org/pypi/pystache
.. _PyPI: http://pypi.python.org/pypi/pystache
.. _Pystache: https://github.com/defunkt/pystache
.. _Pystache: https://github.com/defunkt/pystache
.. _PyYAML: http://pypi.python.org/pypi/PyYAML
.. _semantically versioned: http://semver.org
.. _semantically versioned: http://semver.org
.. _simplejson: http://pypi.python.org/pypi/simplejson/
.. _simplejson: http://pypi.python.org/pypi/simplejson/
.. _simplejson version 2.0.9: http://pypi.python.org/pypi/simplejson/2.0.9
.. _test: http://packages.python.org/distribute/setuptools.html#test
.. _test: http://packages.python.org/distribute/setuptools.html#test
.. _tox: http://pypi.python.org/pypi/tox
.. _tox: http://pypi.python.org/pypi/tox
.. _version 1.0.3: https://github.com/mustache/spec/tree/48c933b0bb780875acbfd15816297e263c53d6f7
.. _version 1.0.3: https://github.com/mustache/spec/tree/48c933b0bb780875acbfd15816297e263c53d6f7
TODO.md
View file @
f30aad9a
...
@@ -7,4 +7,3 @@ TODO
...
@@ -7,4 +7,3 @@ TODO
*
Make sure doctest text files can be converted for Python 3 when using tox.
*
Make sure doctest text files can be converted for Python 3 when using tox.
*
Make sure command parsing to pystache-test doesn't break with Python 2.4 and earlier.
*
Make sure command parsing to pystache-test doesn't break with Python 2.4 and earlier.
*
Combine pystache-test with the main command.
*
Combine pystache-test with the main command.
*
Add a unittest that pystache.__version__ matches the version in setup.py.
pystache/tests/main.py
View file @
f30aad9a
...
@@ -9,15 +9,16 @@ This module is for our test console script.
...
@@ -9,15 +9,16 @@ This module is for our test console script.
import
os
import
os
import
sys
import
sys
import
unittest
from
unittest
import
TestProgram
from
unittest
import
TestProgram
import
pystache
from
pystache.tests.common
import
PACKAGE_DIR
,
PROJECT_DIR
,
SPEC_TEST_DIR
,
UNITTEST_FILE_PREFIX
from
pystache.tests.common
import
PACKAGE_DIR
,
PROJECT_DIR
,
SPEC_TEST_DIR
,
UNITTEST_FILE_PREFIX
from
pystache.tests.common
import
get_module_names
from
pystache.tests.common
import
get_module_names
from
pystache.tests.doctesting
import
get_doctests
from
pystache.tests.doctesting
import
get_doctests
from
pystache.tests.spectesting
import
get_spec_tests
from
pystache.tests.spectesting
import
get_spec_tests
# TODO: enhance this function to create spec-test tests.
def
run_tests
(
sys_argv
):
def
run_tests
(
sys_argv
):
"""
"""
Run all tests in the project.
Run all tests in the project.
...
@@ -46,6 +47,8 @@ def run_tests(sys_argv):
...
@@ -46,6 +47,8 @@ def run_tests(sys_argv):
# auto-detect all unit tests.
# auto-detect all unit tests.
module_names
=
_discover_test_modules
(
PACKAGE_DIR
)
module_names
=
_discover_test_modules
(
PACKAGE_DIR
)
sys_argv
.
extend
(
module_names
)
sys_argv
.
extend
(
module_names
)
# Add the current module for unit tests contained here.
sys_argv
.
append
(
__name__
)
_PystacheTestProgram
.
_text_doctest_dir
=
project_dir
_PystacheTestProgram
.
_text_doctest_dir
=
project_dir
_PystacheTestProgram
.
_spec_test_dir
=
spec_test_dir
_PystacheTestProgram
.
_spec_test_dir
=
spec_test_dir
...
@@ -78,6 +81,19 @@ def _discover_test_modules(package_dir):
...
@@ -78,6 +81,19 @@ def _discover_test_modules(package_dir):
return
names
return
names
class
SetupTests
(
unittest
.
TestCase
):
"""Tests about setup.py."""
def
test_version
(
self
):
"""
Test that setup.py's version matches the package's version.
"""
from
setup
import
VERSION
self
.
assertEqual
(
VERSION
,
pystache
.
__version__
)
# The function unittest.main() is an alias for unittest.TestProgram's
# The function unittest.main() is an alias for unittest.TestProgram's
# constructor. TestProgram's constructor calls self.runTests() as its
# constructor. TestProgram's constructor calls self.runTests() as its
# final step, which expects self.test to be set. The constructor sets
# final step, which expects self.test to be set. The constructor sets
...
...
pystache/tests/spectesting.py
View file @
f30aad9a
...
@@ -61,6 +61,9 @@ def get_spec_tests(spec_test_dir):
...
@@ -61,6 +61,9 @@ def get_spec_tests(spec_test_dir):
Return a list of unittest.TestCase instances.
Return a list of unittest.TestCase instances.
"""
"""
# TODO: use logging module instead.
print
"pystache: spec tests: using
%
s"
%
_get_parser_info
()
cases
=
[]
cases
=
[]
# Make this absolute for easier diagnosis in case of error.
# Make this absolute for easier diagnosis in case of error.
...
@@ -90,6 +93,10 @@ def get_spec_tests(spec_test_dir):
...
@@ -90,6 +93,10 @@ def get_spec_tests(spec_test_dir):
return
cases
return
cases
def
_get_parser_info
():
return
"
%
s (version
%
s)"
%
(
parser
.
__name__
,
parser
.
__version__
)
def
_read_spec_tests
(
path
):
def
_read_spec_tests
(
path
):
"""
"""
Return a list of unittest.TestCase instances.
Return a list of unittest.TestCase instances.
...
@@ -231,8 +238,9 @@ class SpecTestBase(unittest.TestCase, AssertStringMixin):
...
@@ -231,8 +238,9 @@ class SpecTestBase(unittest.TestCase, AssertStringMixin):
def
escape
(
s
):
def
escape
(
s
):
return
s
.
replace
(
"
%
"
,
"
%%
"
)
return
s
.
replace
(
"
%
"
,
"
%%
"
)
parser_info
=
_get_parser_info
()
subs
=
[
repr
(
test_name
),
description
,
os
.
path
.
abspath
(
file_path
),
subs
=
[
repr
(
test_name
),
description
,
os
.
path
.
abspath
(
file_path
),
template
,
repr
(
context
),
parser
.
__version__
,
str
(
parser
)
]
template
,
repr
(
context
),
parser
_info
]
subs
=
tuple
([
escape
(
sub
)
for
sub
in
subs
])
subs
=
tuple
([
escape
(
sub
)
for
sub
in
subs
])
# We include the parsing module version info to help with troubleshooting
# We include the parsing module version info to help with troubleshooting
# yaml/json/simplejson issues.
# yaml/json/simplejson issues.
...
@@ -246,7 +254,7 @@ class SpecTestBase(unittest.TestCase, AssertStringMixin):
...
@@ -246,7 +254,7 @@ class SpecTestBase(unittest.TestCase, AssertStringMixin):
%%
s
%%
s
(using version
%
s of
%
s)
[using
%
s]
"""
%
subs
"""
%
subs
self
.
assertString
(
actual
,
expected
,
format
=
message
)
self
.
assertString
(
actual
,
expected
,
format
=
message
)
setup.cfg
deleted
100644 → 0
View file @
e05966ee
[nosetests]
with-doctest=1
doctest-extension=rst
# Prevent nose from interpreting the load_tests protocol function as a test.
exclude=load_tests
setup.py
View file @
f30aad9a
...
@@ -52,10 +52,11 @@ else:
...
@@ -52,10 +52,11 @@ else:
setup
=
dist
.
setup
setup
=
dist
.
setup
# TODO: use the logging module instead of printing.
# TODO: use the logging module instead of printing.
print
(
"Using: version
%
s of
%
s"
%
(
repr
(
dist
.
__version__
),
repr
(
dist
)))
# TODO: include the following in a verbose mode.
# print("Using: version %s of %s" % (repr(dist.__version__), repr(dist)))
VERSION
=
'0.5.1-alpha'
# Also change in pystache/
init
.py.
VERSION
=
'0.5.1-alpha'
# Also change in pystache/
__init__
.py.
HISTORY_PATH
=
'HISTORY.rst'
HISTORY_PATH
=
'HISTORY.rst'
LICENSE_PATH
=
'LICENSE'
LICENSE_PATH
=
'LICENSE'
...
@@ -134,7 +135,6 @@ else:
...
@@ -134,7 +135,6 @@ else:
extra
=
{
extra
=
{
# Causes 2to3 to be run during the build step.
# Causes 2to3 to be run during the build step.
'use_2to3'
:
True
,
'use_2to3'
:
True
,
'convert_2to3_doctests'
:
[
README_PATH
],
}
}
# We use the package simplejson for older Python versions since Python
# We use the package simplejson for older Python versions since Python
...
@@ -151,8 +151,6 @@ if py_version < (2, 5):
...
@@ -151,8 +151,6 @@ if py_version < (2, 5):
requires
.
append
(
'simplejson<2.1'
)
requires
.
append
(
'simplejson<2.1'
)
elif
py_version
<
(
2
,
6
):
elif
py_version
<
(
2
,
6
):
requires
.
append
(
'simplejson'
)
requires
.
append
(
'simplejson'
)
else
:
requires
.
append
(
'pyyaml'
)
INSTALL_REQUIRES
=
requires
INSTALL_REQUIRES
=
requires
...
@@ -188,7 +186,6 @@ def main(sys_argv):
...
@@ -188,7 +186,6 @@ def main(sys_argv):
'pystache.tests.data.locator'
:
template_files
,
'pystache.tests.data.locator'
:
template_files
,
'pystache.tests.examples'
:
template_files
,
'pystache.tests.examples'
:
template_files
,
},
},
test_suite
=
'pystache.tests'
,
entry_points
=
{
entry_points
=
{
'console_scripts'
:
[
'console_scripts'
:
[
'pystache=pystache.commands.render:main'
,
'pystache=pystache.commands.render:main'
,
...
...
tox.ini
View file @
f30aad9a
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
# http://pypi.python.org/pypi/tox
# http://pypi.python.org/pypi/tox
#
#
[tox]
[tox]
envlist
=
py24,py25,py26,py27,py31,py32
envlist
=
py24,py25,py26,py27,py
27-yaml,py
31,py32
[testenv]
[testenv]
# Change the working directory so that we don't import the pystache located
# Change the working directory so that we don't import the pystache located
...
@@ -12,3 +12,12 @@ changedir =
...
@@ -12,3 +12,12 @@ changedir =
{envbindir}
{envbindir}
commands
=
commands
=
pystache-test
{toxinidir}
{toxinidir}/ext/spec/specs
pystache-test
{toxinidir}
{toxinidir}/ext/spec/specs
# Check that the spec tests work with PyYAML.
[testenv:py27-yaml]
deps
=
PyYAML
changedir
=
{envbindir}
commands
=
pystache-test
{toxinidir}
{toxinidir}/ext/spec/specs
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment