Commits

Ned Batchelder committed cd9bf05

Use nose for running tests.

Comments (0)

Files changed (4)

 	python checkeol.py
 
 tests: $(TEST_ZIP)
-	python test_coverage.py
+	nosetests
 
 $(TEST_ZIP): test/covmodzip1.py
 	zip -j $@ $+
 
 * 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.
 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

test_files.py

-# 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')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.