Покрытие кода Django 4.1, вызывающее OSError при запуске
я использую python 3.10.8, django 4.1.4 и покрытие 6.5.0 . Я попытался добавить библиотеку покрытия в свой проект django, чтобы измерить покрытие тестами, я следовал процессу установки, как показано в официальной документации Django по тестированию.
Всякий раз, когда я запускаю команду ниже, возникает ошибка.
coverage run --source='.' manage.py test myapp
имя myapp - это фиктивное имя вместо моего пользовательского имени приложения
Ошибка :
OSError: [WinError 127] The specified procedure could not be found
Полный Traceback предоставляется здесь
Traceback (most recent call last):
File "C:\Users\DUDO\Desktop\projects\salespace inc\app\web\manage.py", line 28, in <module>
main()
File "C:\Users\DUDO\Desktop\projects\salespace inc\app\web\manage.py", line 24, in main
execute_from_command_line(sys.argv)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\core\management\__init__.py", line 420, in execute
django.setup()
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\apps\registry.py", line 116, in populate
app_config.import_models()
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\apps\config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\DUDO\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\auth\models.py", line 3, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\auth\base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\models\base.py", line 141, in __new__
new_class.add_to_class("_meta", Options(meta, app_label))
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\models\base.py", line 369, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\models\options.py", line 231, in contribute_to_class
self.db_table, connection.ops.max_name_length()
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\utils\connection.py", line 15, in __getattr__
return getattr(self._connections[self._alias], item)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\utils\connection.py", line 62, in __getitem__
conn = self.create_connection(alias)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\utils.py", line 193, in create_connection
backend = load_backend(db["ENGINE"])
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\utils.py", line 113, in load_backend
return import_module("%s.base" % backend_name)
File "C:\Users\DUDO\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\backends\postgis\base.py", line 6, in <module>
from .features import DatabaseFeatures
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\backends\postgis\features.py", line 1, in <module>
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\backends\base\features.py", line 3, in <module>
from django.contrib.gis.db import models
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\models\__init__.py", line 3, in <module>
import django.contrib.gis.db.models.functions # NOQA
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\models\functions.py", line 3, in <module>
from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\models\fields.py", line 3, in <module>
from django.contrib.gis import forms, gdal
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\forms\__init__.py", line 3, in <module>
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\gdal\datasource.py", line 40, in <module>
from django.contrib.gis.gdal.driver import Driver
PS C:\Users\DUDO\Desktop\projects\salespace inc\app\web> coverage run manage.py test accounts
Traceback (most recent call last):
File "C:\Users\DUDO\Desktop\projects\salespace inc\app\web\manage.py", line 28, in <module>
main()
File "C:\Users\DUDO\Desktop\projects\salespace inc\app\web\manage.py", line 24, in main
execute_from_command_line(sys.argv)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\core\management\__init__.py", line 420, in execute
django.setup()
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\apps\registry.py", line 116, in populate
app_config.import_models()
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\apps\config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\DUDO\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\auth\models.py", line 3, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\auth\base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\models\base.py", line 141, in __new__
new_class.add_to_class("_meta", Options(meta, app_label))
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\models\base.py", line 369, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\models\options.py", line 231, in contribute_to_class
self.db_table, connection.ops.max_name_length()
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\utils\connection.py", line 15, in __getattr__
return getattr(self._connections[self._alias], item)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\utils\connection.py", line 62, in __getitem__
conn = self.create_connection(alias)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\utils.py", line 193, in create_connection
backend = load_backend(db["ENGINE"])
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\db\utils.py", line 113, in load_backend
return import_module("%s.base" % backend_name)
File "C:\Users\DUDO\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\backends\postgis\base.py", line 6, in <module>
from .features import DatabaseFeatures
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\backends\postgis\features.py", line 1, in <module>
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\backends\base\features.py", line 3, in <module>
from django.contrib.gis.db import models
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\models\__init__.py", line 3, in <module>
import django.contrib.gis.db.models.functions # NOQA
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\models\functions.py", line 3, in <module>
from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\db\models\fields.py", line 3, in <module>
from django.contrib.gis import forms, gdal
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\forms\__init__.py", line 3, in <module>
from .fields import ( # NOQA
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\forms\fields.py", line 2, in <module>
from django.contrib.gis.gdal import GDALException
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\gdal\__init__.py", line 28, in <module>
from django.contrib.gis.gdal.datasource import DataSource
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\gdal\datasource.py", line 40, in <module>
from django.contrib.gis.gdal.driver import Driver
from django.contrib.gis.gdal.prototypes import ds as vcapi
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\gdal\prototypes\ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import lgdal
File "C:\Users\DUDO\.virtualenvs\web-15Kcga0E\lib\site-packages\django\contrib\gis\gdal\libgdal.py", line 67, in <module>
lgdal = CDLL(lib_path)
File "C:\Users\DUDO\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] The specified procedure could not be found