diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-03-14 19:38:00 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-03-14 19:38:00 -0400 |
commit | 174f68882d05f8f21961e0776fcfbb7f8b720ac9 (patch) | |
tree | 9de71047ec91d26891deff89fce99b55dc94b3ff | |
parent | dad7ff8429e1c785840687d93dc17bfd43ba8a21 (diff) | |
download | python-coveragepy-git-174f68882d05f8f21961e0776fcfbb7f8b720ac9.tar.gz |
The first working farm test, obsoleting a test_coverage.py test.
-rw-r--r-- | test/farm/000/run.py | 8 | ||||
-rw-r--r-- | test/test_coverage.py | 5 | ||||
-rw-r--r-- | test/test_farm.py | 18 |
3 files changed, 18 insertions, 13 deletions
diff --git a/test/farm/000/run.py b/test/farm/000/run.py index 18425916..8ecfce89 100644 --- a/test/farm/000/run.py +++ b/test/farm/000/run.py @@ -1,7 +1,7 @@ -clean("src", "*,cover") +copy("src", "out") run(""" coverage -x white.py coverage -a white.py - """) -compare("src", "gold", "*,cover") -clean("src", "*,cover") + """, rundir="out") +compare("out", "gold", "*,cover") +clean("out") diff --git a/test/test_coverage.py b/test/test_coverage.py index 4c2f8b6e..41cdf74c 100644 --- a/test/test_coverage.py +++ b/test/test_coverage.py @@ -1822,11 +1822,6 @@ class ApiTests(CoverageTest): """)) -class AnnotationTests(CoverageTest): - def testWhite(self): - self.checkEverything(file='test/white.py', annfile='test/white.py,cover') - - class CmdLineTests(CoverageTest): def help_fn(self, error=None): raise Exception(error or "__doc__") diff --git a/test/test_farm.py b/test/test_farm.py index 50f4fdef..5967bb85 100644 --- a/test/test_farm.py +++ b/test/test_farm.py @@ -21,10 +21,10 @@ class FarmTestCase(object): return cwd def execute(self): - print "Running", self.runpy, "in", self.dir cwd = self.cd(self.dir) - glo = dict([(a, getattr(self, a)) for a in "run compare clean".split()]) + fns = "copy run compare clean".split() + glo = dict([(fn, getattr(self, fn)) for fn in fns]) execfile(self.runpy, glo) self.cd(cwd) @@ -36,6 +36,12 @@ class FarmTestCase(object): # Functions usable inside farm run.py files + def copy(self, src, dst): + """Copy a directory.""" + + shutil.rmtree(dst, ignore_errors=True) + shutil.copytree(src, dst) + def run(self, cmds, rundir="src"): """Run a list of commands. @@ -52,8 +58,12 @@ class FarmTestCase(object): def compare(self, dir1, dir2, filepattern=None): dc = filecmp.dircmp(dir1, dir2) - - pass + diff_files = self.fnmatch_list(dc.diff_files, filepattern) + left_only = self.fnmatch_list(dc.left_only, filepattern) + right_only = self.fnmatch_list(dc.right_only, filepattern) + assert not diff_files, "Files differ: %s" % (diff_files) + assert not left_only, "Files in %s only: %s" % (dir1, left_only) + assert not right_only, "Files in %s only: %s" % (dir2, right_only) def clean(self, cleandir): shutil.rmtree(cleandir) |