summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-04-14 06:12:09 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-04-14 06:12:09 -0400
commite6e6bdfa70a918aeb4f436c1739e7baf75d2e75f (patch)
treea145caea46fe09d51d84a0f5f7fc5c75707c807a
parent8979a69e1dfd78cc96f9b6efd111c9d8cf92e120 (diff)
downloadpython-coveragepy-git-e6e6bdfa70a918aeb4f436c1739e7baf75d2e75f.tar.gz
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.
-rw-r--r--Makefile4
-rw-r--r--igor.py19
-rw-r--r--tests/eggsrc/setup.py11
-rw-r--r--tests/test_config.py4
-rw-r--r--tests/test_filereporter.py27
-rw-r--r--tests/zipsrc/zip1/__init__.py (renamed from tests/eggsrc/egg1/__init__.py)0
-rw-r--r--tests/zipsrc/zip1/zip1.py (renamed from tests/eggsrc/egg1/egg1.py)4
-rw-r--r--tox.ini3
8 files changed, 24 insertions, 48 deletions
diff --git a/Makefile b/Makefile
index b5cb0903..eeb10535 100644
--- a/Makefile
+++ b/Makefile
@@ -24,9 +24,7 @@ clean: clean_platform ## Remove artifacts of test execution, i
rm -f .coverage .coverage.* coverage.xml .metacov*
rm -f .tox/*/lib/*/site-packages/zzz_metacov.pth
rm -f */.coverage */*/.coverage */*/*/.coverage */*/*/*/.coverage */*/*/*/*/.coverage */*/*/*/*/*/.coverage
- rm -f tests/covmain.zip tests/zipmods.zip
- rm -rf tests/eggsrc/build tests/eggsrc/dist tests/eggsrc/*.egg-info
- rm -f setuptools-*.egg distribute-*.egg distribute-*.tar.gz
+ rm -f tests/covmain.zip tests/zipmods.zip tests/zip1.zip
rm -rf doc/_build doc/_spell doc/sample_html_beta
rm -rf tmp
rm -rf .cache .pytest_cache .hypothesis
diff --git a/igor.py b/igor.py
index a4a460c0..c99c8c3a 100644
--- a/igor.py
+++ b/igor.py
@@ -220,8 +220,10 @@ def do_zip_mods():
"""Build the zipmods.zip file."""
zf = zipfile.ZipFile("tests/zipmods.zip", "w")
- # Take one file from disk.
+ # Take some files from disk.
zf.write("tests/covmodzip1.py", "covmodzip1.py")
+ zf.write("tests/zipsrc/zip1/__init__.py", "zip1/__init__.py")
+ zf.write("tests/zipsrc/zip1/zip1.py", "zip1/zip1.py")
# The others will be various encodings.
source = textwrap.dedent(u"""\
@@ -252,21 +254,6 @@ def do_zip_mods():
zf.close()
-def do_install_egg():
- """Install the egg1 egg for tests."""
- # I am pretty certain there are easier ways to install eggs...
- cur_dir = os.getcwd()
- os.chdir("tests/eggsrc")
- with ignore_warnings():
- import distutils.core
- distutils.core.run_setup("setup.py", ["--quiet", "bdist_egg"])
- egg = glob.glob("dist/*.egg")[0]
- distutils.core.run_setup(
- "setup.py", ["--quiet", "easy_install", "--no-deps", "--zip-ok", egg]
- )
- os.chdir(cur_dir)
-
-
def do_check_eol():
"""Check files for incorrect newlines and trailing whitespace."""
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/eggsrc/egg1/__init__.py b/tests/zipsrc/zip1/__init__.py
index e69de29b..e69de29b 100644
--- a/tests/eggsrc/egg1/__init__.py
+++ b/tests/zipsrc/zip1/__init__.py
diff --git a/tests/eggsrc/egg1/egg1.py b/tests/zipsrc/zip1/zip1.py
index 939386e3..79e0ebc3 100644
--- a/tests/eggsrc/egg1/egg1.py
+++ b/tests/zipsrc/zip1/zip1.py
@@ -1,7 +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 egg file!
+# My zip file!
-walrus = "Eggman"
+lighter = "Zippo"
says = "coo-coo cachoo"
diff --git a/tox.ini b/tox.ini
index 6cccbcbe..fba1593c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -36,9 +36,8 @@ commands =
python setup.py --quiet clean develop
# Create tests/zipmods.zip
- # Install the egg1 egg
# Remove the C extension so that we can test the PyTracer
- python igor.py zip_mods install_egg remove_extension
+ python igor.py zip_mods remove_extension
# Test with the PyTracer
python igor.py test_with_tracer py {posargs}