Commit 150d4c45 by Chris Jerdonek

The pystache-tests script now accepts a spec test directory argument.

parent ae755339
......@@ -32,10 +32,17 @@ def run_tests(sys_argv):
try:
# TODO: use optparse command options instead.
project_dir = sys_argv[1]
sys_argv.pop()
sys_argv.pop(1)
except IndexError:
project_dir = PROJECT_DIR
try:
# TODO: use optparse command options instead.
spec_test_dir = sys_argv[1]
sys_argv.pop(1)
except IndexError:
spec_test_dir = SPEC_TEST_DIR
if len(sys_argv) <= 1 or sys_argv[-1].startswith("-"):
# Then no explicit module or test names were provided, so
# auto-detect all unit tests.
......@@ -43,7 +50,7 @@ def run_tests(sys_argv):
sys_argv.extend(module_names)
_PystacheTestProgram._text_doctest_dir = project_dir
_PystacheTestProgram._spec_test_dir = SPEC_TEST_DIR
_PystacheTestProgram._spec_test_dir = spec_test_dir
# We pass None for the module because we do not want the unittest
# module to resolve module names relative to a given module.
......
......@@ -77,14 +77,18 @@ def get_spec_tests(spec_test_dir):
case = _deserialize_spec_test(data, path)
cases.append(case)
# Store this as a value so that CheckSpecTestsFound is not checking
# a reference to cases that contains itself.
spec_test_count = len(cases)
# This test case lets us alert the user that spec tests are missing.
class CheckSpecTestsFound(unittest.TestCase):
def runTest(self):
if len(cases) > 0:
if spec_test_count > 0:
return
raise Exception("Spec tests not found in: %s\n "
"Consult the README file on how to add the Mustache spec tests." % repr(spec_test_dir))
raise Exception("Spec tests not found--\n in %s\n"
" Consult the README file on how to add the Mustache spec tests." % repr(spec_test_dir))
case = CheckSpecTestsFound()
cases.append(case)
......
......@@ -6,7 +6,9 @@
envlist = py24,py25,py26,py27,py31,py32
[testenv]
# Change the working directory so that we don't import the pystache located
# in the original location.
changedir =
{envbindir}
commands =
pystache-test {toxinidir}
pystache-test {toxinidir} {toxinidir}/ext/spec/specs
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment