summaryrefslogtreecommitdiff
path: root/tests/coveragetest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/coveragetest.py')
-rw-r--r--tests/coveragetest.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index caddbeed..94f50852 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -6,6 +6,7 @@
import contextlib
import datetime
import functools
+import glob
import os
import random
import re
@@ -347,6 +348,13 @@ class CoverageTest(
msg = "File %r shouldn't exist" % fname
self.assertTrue(not os.path.exists(fname), msg)
+ def assert_file_count(self, pattern, count):
+ """Assert that there are `count` files matching `pattern`."""
+ files = glob.glob(pattern)
+ msg = "There should be {} files matching {!r}, but there are these: {}"
+ msg = msg.format(count, pattern, files)
+ self.assertEqual(len(files), count, msg)
+
def assert_starts_with(self, s, prefix, msg=None):
"""Assert that `s` starts with `prefix`."""
if not s.startswith(prefix):