Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e6e6bdf

Browse files
committedApr 14, 2021
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.
1 parent 8979a69 commit e6e6bdf

File tree

8 files changed

+24
-48
lines changed

8 files changed

+24
-48
lines changed
 

‎Makefile

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ clean: clean_platform ## Remove artifacts of test execution, i
2424
rm -f .coverage .coverage.* coverage.xml .metacov*
2525
rm -f .tox/*/lib/*/site-packages/zzz_metacov.pth
2626
rm -f */.coverage */*/.coverage */*/*/.coverage */*/*/*/.coverage */*/*/*/*/.coverage */*/*/*/*/*/.coverage
27-
rm -f tests/covmain.zip tests/zipmods.zip
28-
rm -rf tests/eggsrc/build tests/eggsrc/dist tests/eggsrc/*.egg-info
29-
rm -f setuptools-*.egg distribute-*.egg distribute-*.tar.gz
27+
rm -f tests/covmain.zip tests/zipmods.zip tests/zip1.zip
3028
rm -rf doc/_build doc/_spell doc/sample_html_beta
3129
rm -rf tmp
3230
rm -rf .cache .pytest_cache .hypothesis

‎igor.py

+3-16
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,10 @@ def do_zip_mods():
220220
"""Build the zipmods.zip file."""
221221
zf = zipfile.ZipFile("tests/zipmods.zip", "w")
222222

223-
# Take one file from disk.
223+
# Take some files from disk.
224224
zf.write("tests/covmodzip1.py", "covmodzip1.py")
225+
zf.write("tests/zipsrc/zip1/__init__.py", "zip1/__init__.py")
226+
zf.write("tests/zipsrc/zip1/zip1.py", "zip1/zip1.py")
225227

226228
# The others will be various encodings.
227229
source = textwrap.dedent(u"""\
@@ -252,21 +254,6 @@ def do_zip_mods():
252254
zf.close()
253255

254256

255-
def do_install_egg():
256-
"""Install the egg1 egg for tests."""
257-
# I am pretty certain there are easier ways to install eggs...
258-
cur_dir = os.getcwd()
259-
os.chdir("tests/eggsrc")
260-
with ignore_warnings():
261-
import distutils.core
262-
distutils.core.run_setup("setup.py", ["--quiet", "bdist_egg"])
263-
egg = glob.glob("dist/*.egg")[0]
264-
distutils.core.run_setup(
265-
"setup.py", ["--quiet", "easy_install", "--no-deps", "--zip-ok", egg]
266-
)
267-
os.chdir(cur_dir)
268-
269-
270257
def do_check_eol():
271258
"""Check files for incorrect newlines and trailing whitespace."""
272259

‎tests/eggsrc/setup.py

-11
This file was deleted.

‎tests/test_config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,8 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest):
533533
534534
[testenv]
535535
commands =
536-
# Create tests/zipmods.zip, install the egg1 egg
537-
python igor.py zip_mods install_egg
536+
# Create tests/zipmods.zip
537+
python igor.py zip_mods
538538
"""
539539

540540
def assert_config_settings_are_correct(self, cov):

‎tests/test_filereporter.py

+15-12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""Tests for FileReporters"""
55

66
import os
7+
import sys
78

89
from coverage.plugin import FileReporter
910
from coverage.python import PythonFileReporter
@@ -87,18 +88,20 @@ def test_comparison(self):
8788
assert acu < bcu and acu <= bcu and acu != bcu
8889
assert bcu > acu and bcu >= acu and bcu != acu
8990

90-
def test_egg(self):
91-
# Test that we can get files out of eggs, and read their source files.
92-
# The egg1 module is installed by an action in igor.py.
93-
import egg1
94-
import egg1.egg1
91+
def test_zipfile(self):
92+
sys.path.append("tests/zipmods.zip")
9593

96-
# Verify that we really imported from an egg. If we did, then the
94+
# Test that we can get files out of zipfiles, and read their source files.
95+
# The zip1 module is installed by an action in igor.py.
96+
import zip1
97+
import zip1.zip1
98+
99+
# Verify that we really imported from an zipfile. If we did, then the
97100
# __file__ won't be an actual file, because one of the "directories"
98-
# in the path is actually the .egg zip file.
99-
self.assert_doesnt_exist(egg1.__file__)
101+
# in the path is actually the zip file.
102+
self.assert_doesnt_exist(zip1.__file__)
100103

101-
ecu = PythonFileReporter(egg1)
102-
eecu = PythonFileReporter(egg1.egg1)
103-
assert ecu.source() == u""
104-
assert u"# My egg file!" in eecu.source().splitlines()
104+
z1 = PythonFileReporter(zip1)
105+
z1z1 = PythonFileReporter(zip1.zip1)
106+
assert z1.source() == u""
107+
assert u"# My zip file!" in z1z1.source().splitlines()
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
22
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
33

4-
# My egg file!
4+
# My zip file!
55

6-
walrus = "Eggman"
6+
lighter = "Zippo"
77
says = "coo-coo cachoo"

‎tox.ini

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ commands =
3636
python setup.py --quiet clean develop
3737

3838
# Create tests/zipmods.zip
39-
# Install the egg1 egg
4039
# Remove the C extension so that we can test the PyTracer
41-
python igor.py zip_mods install_egg remove_extension
40+
python igor.py zip_mods remove_extension
4241

4342
# Test with the PyTracer
4443
python igor.py test_with_tracer py {posargs}

0 commit comments

Comments
 (0)
Please sign in to comment.