summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-01-15 09:49:39 -0500
committerNed Batchelder <ned@nedbatchelder.com>2017-01-15 09:49:39 -0500
commita5f5e51f31860c3673a45d74f011fadfeeab1dc4 (patch)
tree09776afa7dad718db03ab5afa12ede6bd476751b /tests/helpers.py
parent1c47034843c1008642f5364094f872197cb87e65 (diff)
downloadpython-coveragepy-a5f5e51f31860c3673a45d74f011fadfeeab1dc4.tar.gz
Add a test of CheckUniqueFilenames
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index ebc15cd..a132872 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -54,11 +54,19 @@ class CheckUniqueFilenames(object):
self.wrapped = wrapped
@classmethod
- def hook(cls, cov, method_name):
- """Replace a method with our checking wrapper."""
- method = getattr(cov, method_name)
+ def hook(cls, obj, method_name):
+ """Replace a method with our checking wrapper.
+
+ The method must take a string as a first argument. That argument
+ will be checked for uniqueness across all the calls to this method.
+
+ The values don't have to be file names actually, just strings, but
+ we only use it for filename arguments.
+
+ """
+ method = getattr(obj, method_name)
hook = cls(method)
- setattr(cov, method_name, hook.wrapper)
+ setattr(obj, method_name, hook.wrapper)
return hook
def wrapper(self, filename, *args, **kwargs):