remove egg test

eggs aren't supported, and Python 3.12 removes setuptools
This commit is contained in:
David Lord 2023-05-02 09:53:31 -07:00
parent 97c830190f
commit 1d7281fe07
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
3 changed files with 1 additions and 56 deletions

View File

@ -865,7 +865,7 @@ def _find_package_path(import_name):
if hasattr(loader, "get_filename"):
filename = loader.get_filename(root_mod_name)
elif hasattr(loader, "archive"):
# zipimporter's loader.archive points to the .egg or .zip file.
# zipimporter's loader.archive points to the .zip file.
filename = loader.archive
else:
# At least one loader is missing both get_filename and archive:

View File

@ -1,7 +1,6 @@
import os
import pkgutil
import sys
import textwrap
import pytest
from _pytest import monkeypatch
@ -154,42 +153,6 @@ def site_packages(modules_tmpdir, monkeypatch):
return rv
@pytest.fixture
def install_egg(modules_tmpdir, monkeypatch):
"""Generate egg from package name inside base and put the egg into
sys.path."""
def inner(name, base=modules_tmpdir):
base.join(name).ensure_dir()
base.join(name).join("__init__.py").ensure()
egg_setup = base.join("setup.py")
egg_setup.write(
textwrap.dedent(
f"""
from setuptools import setup
setup(
name="{name}",
version="1.0",
packages=["site_egg"],
zip_safe=True,
)
"""
)
)
import subprocess
subprocess.check_call(
[sys.executable, "setup.py", "bdist_egg"], cwd=str(modules_tmpdir)
)
(egg_path,) = modules_tmpdir.join("dist/").listdir()
monkeypatch.syspath_prepend(str(egg_path))
return egg_path
return inner
@pytest.fixture
def purge_module(request):
def inner(name):

View File

@ -1,5 +1,3 @@
import sys
import pytest
import flask
@ -107,19 +105,3 @@ def test_prefix_package_paths(
assert site_package.app.instance_path == modules_tmpdir.join("var").join(
"site_package-instance"
)
def test_egg_installed_paths(install_egg, modules_tmpdir, modules_tmpdir_prefix):
modules_tmpdir.mkdir("site_egg").join("__init__.py").write(
"import flask\n\napp = flask.Flask(__name__)"
)
install_egg("site_egg")
try:
import site_egg
assert site_egg.app.instance_path == str(
modules_tmpdir.join("var/").join("site_egg-instance")
)
finally:
if "site_egg" in sys.modules:
del sys.modules["site_egg"]