模块设置不正确

Module not being set up properly

python 的新手,但我虽然一切都设置正确。当我 运行 python -m unittest test.unit.test_oyez_case 时,我得到 AttributeError: 'module' object has no attribute 'test_oyez_case'

抱歉,这是一个常见问题,none 的回复对我有帮助

这是我的文件结构:

├── 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 这样的命令行来 运行 它。可能是您的其他进口商品之一不正确。 ;-)