调试报错如下:
Testing started at 21:08 …
D:\python\python.exe “D:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pycharm_jb_unittest_runner.py” --path D:/work/python_workspace/TestPython/test/caseobject/RunTestCase.py
Launching unittests with arguments python -m unittest D:/work/python_workspace/TestPython/test/caseobject/RunTestCase.py in D:\work\python_workspace\TestPython\test\caseobject
<module ‘ntpath’ from ‘D:\python\lib\ntpath.py’>
D:\work\python_workspace\TestPython\test\caseobject\Case
Ran 1 test in 0.005s
FAILED (errors=1)
Error
Traceback (most recent call last):
File “D:\python\lib\unittest\case.py”, line 60, in testPartExecutor
yield
File “D:\python\lib\unittest\case.py”, line 676, in run
self._callTestMethod(testMethod)
File “D:\python\lib\unittest\case.py”, line 633, in _callTestMethod
method()
File “D:\work\python_workspace\TestPython\test\caseobject\RunTestCase.py”, line 11, in testCaseRun01
suite = unittest.defaultTestLoader.discover(path,“UnitTestCase*.py”)
File “D:\python\lib\unittest\loader.py”, line 346, in discover
raise ImportError(‘Start directory is not importable: %r’ % start_dir)
ImportError: Start directory is not importable: ‘D:\work\python_workspace\TestPython\test\caseobject\Case’
Process finished with exit code 1
请问老师,这个该如何解决呢?我代码是按照你说的这样弄的,但是为什么运行会报这样的错呢?