Skip to content
Myr

remove egg test

Before adoption: this commit came in with the history the project adopted, so no landing records it.

eggs aren't supported, and Python 3.12 removes setuptools

authored by David Lord · committed by David Lord · parent 97c8301 · Browse files · 3 files+1 added−56 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+1 added−56 removed

  • tests:+0 added−55 removed
  • other:+1 added−1 removed

3 files+1 added−56 removed

modified:src/flask/scaffold.py+1 added-1 removed
863 unmodified lines
864865 if hasattr(loader, "get_filename"):866 filename = loader.get_filename(root_mod_name)867 elif hasattr(loader, "archive"):868 # zipimporter's loader.archive points to the .egg or .zip file.868 # zipimporter's loader.archive points to the .zip file.869 filename = loader.archive870 else:871 # At least one loader is missing both get_filename and archive:872 # Google App Engine's HardenedModulesHook, use __file__.
51 unmodified lines
modified:tests/conftest.py-37 removed
1import os2import pkgutil3import sys4import textwrap45import pytest6from _pytest import monkeypatch7
145 unmodified lines
153 return rv154155156@pytest.fixture158def install_egg(modules_tmpdir, monkeypatch):159 """Generate egg from package name inside base and put the egg into160 sys.path."""161162 def inner(name, base=modules_tmpdir):163 base.join(name).ensure_dir()164 base.join(name).join("__init__.py").ensure()165166 egg_setup = base.join("setup.py")167 egg_setup.write(168 textwrap.dedent(169 f"""170 from setuptools import setup171 setup(172 name="{name}",173 version="1.0",174 packages=["site_egg"],175 zip_safe=True,176 )177 """178 )179 )180181 import subprocess182183 subprocess.check_call(184 [sys.executable, "setup.py", "bdist_egg"], cwd=str(modules_tmpdir)185 )186 (egg_path,) = modules_tmpdir.join("dist/").listdir()187 monkeypatch.syspath_prepend(str(egg_path))188 return egg_path189190 return inner191192193@pytest.fixture157def purge_module(request):158 def inner(name):159 request.addfinalizer(lambda: sys.modules.pop(name, None))160
1 unmodified line
modified:tests/test_instance_config.py-18 removed
1import sys21import pytest23import flask4
99 unmodified lines
104105 assert site_package.app.instance_path == modules_tmpdir.join("var").join(106 "site_package-instance"107 )110111112def test_egg_installed_paths(install_egg, modules_tmpdir, modules_tmpdir_prefix):113 modules_tmpdir.mkdir("site_egg").join("__init__.py").write(114 "import flask\n\napp = flask.Flask(__name__)"115 )116 install_egg("site_egg")117 try:118 import site_egg119120 assert site_egg.app.instance_path == str(121 modules_tmpdir.join("var/").join("site_egg-instance")122 )123 finally:124 if "site_egg" in sys.modules:125 del sys.modules["site_egg"]