diff --git a/pypiserver/__init__.py b/pypiserver/__init__.py index 49d7d32..9a9f5a4 100644 --- a/pypiserver/__init__.py +++ b/pypiserver/__init__.py @@ -1,4 +1,5 @@ import re as _re +import sys version = __version__ = "1.2.1.dev0" __version_info__ = tuple(_re.split('[.-]', __version__)) @@ -120,7 +121,10 @@ def app(**kwds): :func:`default_config()`. Check the docstring of this function for supported kwds. """ - from . import core, _app + from . import core + + _app = __import__("_app", globals(), locals(), ["."], 1) + sys.modules.pop('pypiserver._app', None) kwds = default_config(**kwds) config, packages = core.configure(**kwds) diff --git a/tests/test_init.py b/tests/test_init.py index abb11f1..9e26f4f 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -35,5 +35,7 @@ def test_paste_app_factory(conf_options, monkeypatch): lambda **x: (x, [x.keys()])) pypiserver.paste_app_factory({}, **conf_options) - - +def test_app_factory(monkeypatch): + monkeypatch.setattr('pypiserver.core.configure', + lambda **x: (x, [x.keys()])) + assert pypiserver.app() is not pypiserver.app()