From c7bbf9ddf8aef2cec903cad5bc40670f6e1336ff Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 14 Jan 2020 09:20:44 -0500 Subject: [PATCH 1/2] Work with coverage 4.x or 5.x --- tests/plugin_test.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/plugin_test.py b/tests/plugin_test.py index ea35fd1..e8ab006 100644 --- a/tests/plugin_test.py +++ b/tests/plugin_test.py @@ -136,7 +136,11 @@ def run_django_coverage( self.cov.stop() self.cov.save() # Warning! Accessing secret internals! - for pl in self.cov.plugins: + if hasattr(self.cov, 'plugins'): + plugins = self.cov.plugins + else: + plugins = self.cov._plugins + for pl in plugins: if isinstance(pl, DjangoTemplatePlugin): if not pl._coverage_enabled: raise PluginDisabled() @@ -174,7 +178,7 @@ def get_analysis(self, name=None): def measured_files(self): """Get the list of measured files, in relative form.""" - return [os.path.relpath(f) for f in self.cov.data.measured_files()] + return [os.path.relpath(f) for f in self.cov.get_data().measured_files()] def assert_analysis(self, executable, missing=None, name=None): """Assert that the analysis for `name` is right.""" From 630d4928ecec43eb8a41bdf6fa0eb7e6b673778f Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 22 Jan 2020 23:01:45 -0500 Subject: [PATCH 2/2] Remove v5 prohibition --- README.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index ba433de..0b68a8e 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,7 @@ Supported Python versions: 2.7, 3.4, 3.5, 3.6, 3.7 and 3.8. Supported Django versions: 1.8, 1.11, 2.0, 2.1, 2.2 and 3.0. -Supported coverage.py version 4.x . Support for version 5 is on the way! +Supported coverage.py version 4.x or 5.x. The plugin is pip installable:: diff --git a/setup.py b/setup.py index 95751d5..eec098a 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ def read(*names, **kwargs): url='https://github.com/nedbat/django_coverage_plugin', packages=['django_coverage_plugin'], install_requires=[ - 'coverage >= 4.0 , < 5', + 'coverage', 'six >= 1.4.0', ], license='Apache 2.0',