dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00399
Test runners, nose and python 2.7
Hi,
As you might've seen I fixed an error earlier today in the tutorial. I
assumed the tutorial was always run, but that doesn't appear to be the
case: nosetests doesn't run doctests by default.
There is an option to enable the running of doctests, but with that the
setup/teardown function for the doctests as we specify them in
our tutorial_test_suite() function don't get used. Is anybody aware of
a way to get nose to use a test-suite function? I briefly looked over
the documentation but couldn't find anything.
With the wider availability of python 2.7 - which includes a SkipTest
class - I would also like to support using the standard Python
test runner. If python 2.4, 2.5 or 2.6 is in use we can
fallback to an alternative such as testtools.run, twisted.trial.run
or unittest2.
The attached patch changes the Makefile to use unittest's test runner if it is
recent enough and otherwise fall back to testtools.
Is anybody particularly attached to nose for some reason? Other thoughts?
Cheers,
Jelmer
=== modified file 'Makefile'
--- Makefile 2010-12-20 14:47:32 +0000
+++ Makefile 2010-12-26 01:09:46 +0000
@@ -1,8 +1,12 @@
PYTHON = python
SETUP = $(PYTHON) setup.py
PYDOCTOR ?= pydoctor
-TESTRUNNER = $(shell which nosetests)
-TESTFLAGS =
+ifeq ($(shell $(PYTHON) -c "import sys; print sys.version_info >= (2, 7)"),True)
+TESTRUNNER = unittest
+else
+TESTRUNNER = testtools
+endif
+RUNTEST = PYTHONPATH=.:$(PYTHONPATH) $(PYTHON) -m $(TESTRUNNER)
all: build
@@ -19,20 +23,14 @@
$(SETUP) install
check:: build
- PYTHONPATH=.:$(PYTHONPATH) $(PYTHON) $(TESTRUNNER) dulwich
+ $(RUNTEST) dulwich.tests.test_suite
check-nocompat:: build
- PYTHONPATH=.:$(PYTHONPATH) $(PYTHON) $(TESTRUNNER) -e compat dulwich
+ $(RUNTEST) dulwich.tests.nocompat_test_suite
check-noextensions:: clean
- PYTHONPATH=.:$(PYTHONPATH) $(PYTHON) $(TESTRUNNER) $(TESTFLAGS) dulwich
+ $(RUNTEST) dulwich.tests.test_suite
clean::
$(SETUP) clean --all
rm -f dulwich/*.so
-
-coverage:: build
- PYTHONPATH=.:$(PYTHONPATH) $(PYTHON) $(TESTRUNNER) --cover-package=dulwich --with-coverage --cover-erase --cover-inclusive dulwich
-
-coverage-annotate: coverage
- python-coverage -a -o /usr
Attachment:
signature.asc
Description: Digital signature
Follow ups