From e6e6bdfa70a918aeb4f436c1739e7baf75d2e75f Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 14 Apr 2021 06:12:09 -0400 Subject: test: remove the .egg test People don't use .egg much anymore, distutils is showing deprecation warnings, and coverage.py only deals with them the same way it deals with .zip files, so let's just rely on a .zip test to cover that. --- tests/eggsrc/egg1/__init__.py | 0 tests/eggsrc/egg1/egg1.py | 7 ------- tests/eggsrc/setup.py | 11 ----------- tests/test_config.py | 4 ++-- tests/test_filereporter.py | 27 +++++++++++++++------------ tests/zipsrc/zip1/__init__.py | 0 tests/zipsrc/zip1/zip1.py | 7 +++++++ 7 files changed, 24 insertions(+), 32 deletions(-) delete mode 100644 tests/eggsrc/egg1/__init__.py delete mode 100644 tests/eggsrc/egg1/egg1.py delete mode 100644 tests/eggsrc/setup.py create mode 100644 tests/zipsrc/zip1/__init__.py create mode 100644 tests/zipsrc/zip1/zip1.py (limited to 'tests') diff --git a/tests/eggsrc/egg1/__init__.py b/tests/eggsrc/egg1/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/eggsrc/egg1/egg1.py b/tests/eggsrc/egg1/egg1.py deleted file mode 100644 index 939386e3..00000000 --- a/tests/eggsrc/egg1/egg1.py +++ /dev/null @@ -1,7 +0,0 @@ -# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt - -# My egg file! - -walrus = "Eggman" -says = "coo-coo cachoo" diff --git a/tests/eggsrc/setup.py b/tests/eggsrc/setup.py deleted file mode 100644 index 26a0b650..00000000 --- a/tests/eggsrc/setup.py +++ /dev/null @@ -1,11 +0,0 @@ -# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt - -from setuptools import setup - -setup( - name="covtestegg1", - packages=['egg1'], - zip_safe=True, - install_requires=[], - ) diff --git a/tests/test_config.py b/tests/test_config.py index b1611c1b..3330290f 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -533,8 +533,8 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): [testenv] commands = - # Create tests/zipmods.zip, install the egg1 egg - python igor.py zip_mods install_egg + # Create tests/zipmods.zip + python igor.py zip_mods """ def assert_config_settings_are_correct(self, cov): diff --git a/tests/test_filereporter.py b/tests/test_filereporter.py index d928eea4..8ce2201d 100644 --- a/tests/test_filereporter.py +++ b/tests/test_filereporter.py @@ -4,6 +4,7 @@ """Tests for FileReporters""" import os +import sys from coverage.plugin import FileReporter from coverage.python import PythonFileReporter @@ -87,18 +88,20 @@ class FileReporterTest(UsingModulesMixin, CoverageTest): assert acu < bcu and acu <= bcu and acu != bcu assert bcu > acu and bcu >= acu and bcu != acu - def test_egg(self): - # Test that we can get files out of eggs, and read their source files. - # The egg1 module is installed by an action in igor.py. - import egg1 - import egg1.egg1 + def test_zipfile(self): + sys.path.append("tests/zipmods.zip") - # Verify that we really imported from an egg. If we did, then the + # Test that we can get files out of zipfiles, and read their source files. + # The zip1 module is installed by an action in igor.py. + import zip1 + import zip1.zip1 + + # Verify that we really imported from an zipfile. If we did, then the # __file__ won't be an actual file, because one of the "directories" - # in the path is actually the .egg zip file. - self.assert_doesnt_exist(egg1.__file__) + # in the path is actually the zip file. + self.assert_doesnt_exist(zip1.__file__) - ecu = PythonFileReporter(egg1) - eecu = PythonFileReporter(egg1.egg1) - assert ecu.source() == u"" - assert u"# My egg file!" in eecu.source().splitlines() + z1 = PythonFileReporter(zip1) + z1z1 = PythonFileReporter(zip1.zip1) + assert z1.source() == u"" + assert u"# My zip file!" in z1z1.source().splitlines() diff --git a/tests/zipsrc/zip1/__init__.py b/tests/zipsrc/zip1/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/zipsrc/zip1/zip1.py b/tests/zipsrc/zip1/zip1.py new file mode 100644 index 00000000..79e0ebc3 --- /dev/null +++ b/tests/zipsrc/zip1/zip1.py @@ -0,0 +1,7 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt + +# My zip file! + +lighter = "Zippo" +says = "coo-coo cachoo" -- cgit v1.2.1