对python来说是个新手,但我觉得我把一切都安排好了。当我运行python -m unittest test.unit.test_oyez_case
时,我得到AttributeError: 'module' object has no attribute 'test_oyez_case'
抱歉,这是一个常见的问题,没有一个回答对我有帮助
以下是我的文件结构:
├── README.md
└── test
├── __init__.py
├── __init__.pyc
├── integration
│ └── __init__.py
└── unit
├── __init__.py
├── __init__.pyc
├── mocks
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── responses.py
│ └── responses.pyc
├── test_oyez_case.py
└── test_oyez_case.pyc
下面是test/unit/test_oyez_case.py
:
import json
import unittest
import responses
from mocks import responses as api_responses
from puppy_scotus.oyez_case import OyezCase
class TestOyezCase(unittest.TestCase):
. . .
if __name__ == '__main__':
unittest.main()
尝试使用类似
python test_oyez_case.py
的命令行运行它。可能是您的其他导入之一不正确。;-)相关问题 更多 >
编程相关推荐