From 1f950ca6c4c1da6d5f2f37faeb0217e9ff273b75 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 22 Mar 2011 07:58:28 -0400 Subject: Add a test helper for checking on the existence of files. --- test/coveragetest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/coveragetest.py') diff --git a/test/coveragetest.py b/test/coveragetest.py index 8c05f32f..621d7ae2 100644 --- a/test/coveragetest.py +++ b/test/coveragetest.py @@ -340,6 +340,16 @@ class CoverageTest(TestCase): flist2_nice = [self.nice_file(f) for f in flist2] self.assertSameElements(flist1_nice, flist2_nice) + def assert_exists(self, fname): + """Assert that `fname` is a file that exists.""" + msg = "File %r should exist" % fname + self.assert_(os.path.exists(fname), msg) + + def assert_doesnt_exist(self, fname): + """Assert that `fname` is a file that doesn't exist.""" + msg = "File %r shouldn't exist" % fname + self.assert_(not os.path.exists(fname), msg) + def command_line(self, args, ret=OK, _covpkg=None): """Run `args` through the command line. -- cgit v1.2.1