Pytest-django: ربط غير معروف مع أحدث pytest

تم إنشاؤها على ٢ يونيو ٢٠١٨  ·  3تعليقات  ·  مصدر: pytest-dev/pytest-django

بعد ترقية _pytest_ إلى 3.6.0 ، يظهر لي خطأ Unknown hook :

[http<strong i="7">@e6efef5e7fb9</strong> app]$ pytest
===================================================================================== test session starts =====================================================================================
platform linux -- Python 3.6.5, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
Django settings: app.test_settings (from ini file)
rootdir: /var/www/html/app, inifile: pytest.ini
plugins: django-3.2.1, cov-2.5.1
collecting 95 items                                                                                                                                                                           INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/_pytest/main.py", line 107, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/_pytest/main.py", line 144, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/pluggy/__init__.py", line 617, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/pluggy/__init__.py", line 222, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/pluggy/__init__.py", line 216, in <lambda>
INTERNALERROR>     firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/pluggy/callers.py", line 201, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/pluggy/callers.py", line 76, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/_pytest/main.py", line 154, in pytest_collection
INTERNALERROR>     return session.perform_collect()
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/_pytest/main.py", line 352, in perform_collect
INTERNALERROR>     self.config.pluginmanager.check_pending()
INTERNALERROR>   File "/usr/lib/python3.6/site-packages/pluggy/__init__.py", line 385, in check_pending
INTERNALERROR>     (name, hookimpl.plugin))
INTERNALERROR> pluggy.PluginValidationError: unknown hook 'pytest_django' in plugin <module 'functional_tests.conftest' (<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f43563f8668>)>

================================================================================ no tests ran in 1.55 seconds =================================================================================

هذا محتوى _conftest.py_:

import pytest
import pytest_django.fixtures


@pytest.fixture(scope='module')
def django_db_setup(
    request,
    django_test_environment,
    django_db_blocker,
    django_db_use_migrations,
    django_db_keepdb,
    django_db_createdb,
    django_db_modify_db_settings,
):
    # temporarily no code here
    return pytest_django.fixtures.django_db_setup(
        request,
        django_test_environment,
        django_db_blocker,
        django_db_use_migrations,
        django_db_keepdb,
        django_db_createdb,
        django_db_modify_db_settings,
    )

التعليق الأكثر فائدة

استخدم هذا الأمر

pip uninstall pytest-allure-adaptor
pip install allure-pytest

ال 3 كومينتر

واجهت خطأ مماثل. لكن يبدو أن ترقية pluggy قد حلت المشكلة. لم يكن لدي وقت للتحقيق ولكن لدي الآن pytest==3.7.1 و pytest-django==3.3.3 و pluggy==0.7.1 جميعهم يعملون معًا.

الإغلاق حسب التعليق السابق.

استخدم هذا الأمر

pip uninstall pytest-allure-adaptor
pip install allure-pytest
هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات