diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-01-15 09:49:39 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-01-15 09:49:39 -0500 |
commit | 92de04ca5e44532f3fa78dece8df822557805373 (patch) | |
tree | b1be6758ae71de571a8c12ffc7266dd65f703cda /tests/helpers.py | |
parent | 36a1630ab9b54975369a487595380867a470c06e (diff) | |
download | python-coveragepy-git-92de04ca5e44532f3fa78dece8df822557805373.tar.gz |
Add a test of CheckUniqueFilenames
Diffstat (limited to 'tests/helpers.py')
-rw-r--r-- | tests/helpers.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/helpers.py b/tests/helpers.py index ebc15cd1..a132872e 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): |