summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pystache/tests/test_doctests.py22
-rw-r--r--setup.cfg2
2 files changed, 10 insertions, 14 deletions
diff --git a/pystache/tests/test_doctests.py b/pystache/tests/test_doctests.py
index b9d9895..6bcfcf2 100644
--- a/pystache/tests/test_doctests.py
+++ b/pystache/tests/test_doctests.py
@@ -34,23 +34,17 @@ text_file_paths = ['README.rst']
#
# python setup.py test
#
-# TODO: find a substitute for the load_tests protocol for Python versions
-# before version 2.7.
-#
-# TODO: prevent the load_tests() function below from being interpreted as a
-# unittest when running nosetests. This is causing the test count to be
-# different between `python setup.py test` and `python setup.py nosetests`.
+# Normally, nosetests would interpret this function as a test case (because
+# its name matches the test regular expression) and call it with zero arguments
+# as opposed to the required three. However, we are able to exclude it with
+# an entry like the following in setup.cfg:
#
-# HACK: Allowing load_tests() to be called without arguments is a hack
-# to allow unit tests to be run with nose's nosetests without error.
-# Otherwise, nose interprets the following function as a test case,
-# raising the following error:
+# exclude=load_tests
#
-# TypeError: load_tests() takes exactly 3 arguments (0 given)
+# TODO: find a substitute for the load_tests protocol for Python versions
+# before version 2.7.
#
-def load_tests(loader=None, tests=None, ignore=None):
- if loader is None:
- return
+def load_tests(loader, tests, ignore):
# Since module_relative is False in our calls to DocFileSuite below,
# paths should be OS-specific. Moreover, we choose absolute paths
# so that the current working directory does not come into play.
diff --git a/setup.cfg b/setup.cfg
index f91c44e..472b1ac 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,3 +1,5 @@
[nosetests]
with-doctest=1
doctest-extension=rst
+# Prevent nose from interpreting the load_tests protocol function as a test.
+exclude=load_tests