首页 > 解决方案 > ModuleNotFoundError:没有名为“上下文”的模块

问题描述

尝试运行 pyVows 测试时出现以下错误:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\unittest\loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "C:\Program Files\Python38\lib\unittest\loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "D:\Programmierung\Python-Projekte\JourneyMap\JourneyMap\tests.py", line 2, in <module>
    from django_pyvows.context import DjangoHTTPContext
  File "C:\Users\malo0\AppData\Roaming\Python\Python38\site-packages\django_pyvows\__init__.py", line 11, in <module>
    from context import DjangoContext, DjangoHTTPContext
ModuleNotFoundError: No module named 'context'

我安装了pyVows and django-pyvows我错过了什么吗?我没有找到有用的文档

要求编辑:

from pyvows import Vows, expect
from django_pyvows.context import DjangoHTTPContext

# Create your tests here.


@Vows.batch
class LanguageTest(Vows.Context):
    class LanguageSelectIntegrationTest(DjangoHTTPContext):
        def topic(self):
            return self.get('/')

        def test(self, topic):
            # Test will be here
            pass

标签: djangotesting

解决方案


推荐阅读