Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

flask requiresis_package from import loaders, however this api is optional since PEP 451 #3275

Closed
@asottile

Description

@asottile

For more information:pytest-dev/pytest#5532

https://www.python.org/dev/peps/pep-0451/#api-changes

A compliant PEP 451 loader can avoid a lot of the tricky APIs just through implementingfind_spect -- in this caseis_package is replaced bysubmodule_search_locations being truthy

I'll see if I can't take a stab at this, it looks like this is a reopen of#487

Here's a minimal example:

importflaskapp=flask.Flask(__name__)deftest():pass
$pytest t.py============================= test session starts ==============================platform linux -- Python 3.6.7, pytest-5.0.0, py-1.8.0, pluggy-0.12.0rootdir: /tmp/xcollected 0 items / 1 errors==================================== ERRORS ====================================____________________________ ERROR collecting t.py _____________________________t.py:3: in <module>    app = flask.Flask(__name__)venv/lib/python3.6/site-packages/flask/app.py:381: in __init__    instance_path = self.auto_find_instance_path()venv/lib/python3.6/site-packages/flask/app.py:678: in auto_find_instance_path    prefix, package_path = find_package(self.import_name)venv/lib/python3.6/site-packages/flask/helpers.py:826: in find_package    loader, root_mod_name):venv/lib/python3.6/site-packages/flask/helpers.py:789: in _matching_loader_thinks_module_is_package    loader.__class__.__name__)E   AttributeError: AssertionRewritingHook.is_package() method is missing but is required by Flask of PEP 302 import hooks.  If you do not use import hooks and you encounter this error please file a bug against Flask.!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!=========================== 1 error in 0.31 seconds ============================
$pip freeze --allatomicwrites==1.3.0attrs==19.1.0Click==7.0Flask==1.0.3importlib-metadata==0.18itsdangerous==1.1.0Jinja2==2.10.1MarkupSafe==1.1.1more-itertools==7.1.0packaging==19.0pip==19.1.1pluggy==0.12.0py==1.8.0pyparsing==2.4.0pytest==5.0.0setuptools==41.0.1six==1.12.0wcwidth==0.1.7Werkzeug==0.15.4wheel==0.33.4zipp==0.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp