Skip to content
Myr

Leave eggs when finding the instance path

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 74f4af5 · Browse files · 2 files+22 added−1 removed
This commit

State

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

Diff stats

2 files+22 added−1 removed

  • tests:+17 added−0 removed
  • other:+5 added−1 removed

2 files+22 added−1 removed

modified:flask/app.py+5 added-1 removed
566 unmodified lines
567 # the proper name.568 package_path = self.root_path569 if hasattr(root_mod, '__path__'):570 package_path = os.path.dirname(package_path)571 site_parent, site_folder = os.path.split(package_path)571572 # leave the egg wrapper folder or the actual .egg on the filesystem573 if os.path.basename(package_path).endswith('.egg'):574 package_path = os.path.dirname(package_path)575576 site_parent, site_folder = os.path.split(package_path)577 py_prefix = os.path.abspath(sys.prefix)578 if package_path.startswith(py_prefix):579 base_dir = py_prefix580 elif site_folder == 'site-packages':
980 unmodified lines
modified:tests/flask_tests.py+17 added
1075 unmodified lines
1076 'myapp-instance'))1077 finally:1078 sys.modules['myapp'] = None10791080 def test_egg_installed_paths(self):1081 import types1082 expected_prefix = os.path.abspath(sys.prefix)1083 package_path = os.path.join(expected_prefix, 'lib', 'python2.5',1084 'site-packages', 'MyApp.egg', 'myapp')1085 mod = types.ModuleType('myapp')1086 mod.__path__ = [package_path]1087 mod.__file__ = os.path.join(package_path, '__init__.py')1088 sys.modules['myapp'] = mod1089 try:1090 mod.app = flask.Flask(mod.__name__)1091 self.assertEqual(mod.app.instance_path,1092 os.path.join(expected_prefix, 'share',1093 'myapp-instance'))1094 finally:1095 sys.modules['myapp'] = None109610971098class JSONTestCase(unittest.TestCase):10991100 def test_json_bad_requests(self):1101 app = flask.Flask(__name__)
1098 unmodified lines