From eb8bd102097e9d177ec7c56e3948bcf265004119 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 13 Mar 2009 21:12:36 -0400 Subject: Use nose for running tests. --- Makefile | 2 +- TODO.txt | 2 +- alltests.cmd | 8 ++++---- test_files.py | 53 ----------------------------------------------------- 4 files changed, 6 insertions(+), 59 deletions(-) delete mode 100644 test_files.py diff --git a/Makefile b/Makefile index 1714cd3c..fa62ba6b 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ lint: clean python checkeol.py tests: $(TEST_ZIP) - python test_coverage.py + nosetests $(TEST_ZIP): test/covmodzip1.py zip -j $@ $+ diff --git a/TODO.txt b/TODO.txt index 8a48f687..c9329998 100644 --- a/TODO.txt +++ b/TODO.txt @@ -102,7 +102,7 @@ x Tricky swapping of collector like figleaf, pycov, et al. (Don't need to do * Tests -- Switch to a real test runner, like nose. ++ Switch to a real test runner, like nose. - Tests about the .coverage file. - Tests about the --long-form of arguments. - Tests about overriding the .coverage filename. diff --git a/alltests.cmd b/alltests.cmd index bef277f8..d0f5d09f 100644 --- a/alltests.cmd +++ b/alltests.cmd @@ -1,12 +1,12 @@ call \ned\bin\switchpy 23 python setup.py develop -python test_coverage.py +nosetests call \ned\bin\switchpy 24 python setup.py develop -python test_coverage.py +nosetests call \ned\bin\switchpy 25 python setup.py develop -python test_coverage.py +nosetests call \ned\bin\switchpy 26 python setup.py develop -python test_coverage.py +nosetests diff --git a/test_files.py b/test_files.py deleted file mode 100644 index 88d34a2a..00000000 --- a/test_files.py +++ /dev/null @@ -1,53 +0,0 @@ -# File-based unit tests for coverage.py - -import path, sys, unittest -import coverage - -class OneFileTestCase(unittest.TestCase): - def __init__(self, filename): - unittest.TestCase.__init__(self) - self.filename = filename - - def shortDescription(self): - return self.filename - - def setUp(self): - # Create a temporary directory. - self.noise = str(random.random())[2:] - self.temproot = path.path(tempfile.gettempdir()) / 'test_coverage' - self.tempdir = self.temproot / self.noise - self.tempdir.makedirs() - self.olddir = os.getcwd() - os.chdir(self.tempdir) - # Keep a counter to make every call to checkCoverage unique. - self.n = 0 - - # Capture stdout, so we can use print statements in the tests and not - # pollute the test output. - self.oldstdout = sys.stdout - self.capturedstdout = StringIO() - sys.stdout = self.capturedstdout - coverage.begin_recursive() - - def tearDown(self): - coverage.end_recursive() - sys.stdout = self.oldstdout - # Get rid of the temporary directory. - os.chdir(self.olddir) - self.temproot.rmtree() - - def runTest(self): - # THIS ISN'T DONE YET! - pass - -class MyTestSuite(unittest.TestSuite): - def __init__(self): - unittest.TestSuite.__init__(self) - for f in path.path('test').walk('*.py'): - self.addFile(f) - - def addFile(self, f): - self.addTest(OneFileTestCase(f)) - -if __name__ == '__main__': - unittest.main(defaultTest='MyTestSuite') -- cgit v1.2.1