为什么nosy(nos2)会出错,但python运行的测试正常

为什么nosy(nos2)会出错,但python运行的测试正常,python,nose,nose2,Python,Nose,Nose2,我试图在保存文件时让测试持续运行。 我正试着用爱管闲事的语言 我可以使用python test_1.py运行测试 $ python test_1.py .. ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK 但是nose2给出了 $ nose2 -----------------------------------------------------

我试图在保存文件时让测试持续运行。
我正试着用爱管闲事的语言

我可以使用
python test_1.py运行测试

$ python test_1.py
..
----------------------------------------------------------------------
Ran 2 tests in 0.000s

OK
但是nose2给出了

$ nose2

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
E
======================================================================
ERROR: test_1 (nose2.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_1
Traceback (most recent call last):
  File "/home/durrantm/.local/lib/python3.7/site-packages/nose2/plugins/loader/discovery.py", line 201, in _find_tests_in_file
    module = util.module_from_name(module_name)
  File "/home/durrantm/.local/lib/python3.7/site-packages/nose2/util.py", line 77, in module_from_name
    __import__(name)
  File "/home/durrantm/Dropbox/90_2019/work/code/pair_and_mob/python/for_nose_2/test_1.py", line 10, in <module>
    unittest.main()
  File "/usr/lib/python3.7/unittest/main.py", line 101, in __init__
    self.runTests()
  File "/usr/lib/python3.7/unittest/main.py", line 273, in runTests
    sys.exit(not self.result.wasSuccessful())
SystemExit: False


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

$ cat test_1.py 
import unittest
from mycode import *
class MyFirstTests(unittest.TestCase):
  def test_hello(self):
    self.assertEqual(hello_world(), 'hello world')
  def test_goodbye(self):
    self.assertEqual(goodbye_world(), 'goodbye world')
unittest.main()

$ cat mycode.py
def hello_world():
  return 'hello world'
def goodbye_world():
  return 'goodbye world'
$nose2
----------------------------------------------------------------------
在0.000秒内运行了0个测试
好啊
E
======================================================================
错误:测试_1(nos2.loader.ModuleImportFailure)
----------------------------------------------------------------------
导入错误:无法导入测试模块:测试1
回溯(最近一次呼叫最后一次):
文件“/home/durrantm/.local/lib/python3.7/site packages/nos2/plugins/loader/discovery.py”,第201行,在文件中的查找测试
module=util.module_from_name(module_name)
文件“/home/durrantm/.local/lib/python3.7/site packages/nos2/util.py”,第77行,位于模块\u from\u name中
__导入(名称)
文件“/home/durrantm/Dropbox/90_2019/work/code/pair_and_mob/python/for_nose_2/test_1.py”,第10行,在
unittest.main()
文件“/usr/lib/python3.7/unittest/main.py”,第101行,在__
self.runTests()
runTests中的文件“/usr/lib/python3.7/unittest/main.py”,第273行
sys.exit(不是self.result.wassuctiful())
SystemExit:False
----------------------------------------------------------------------
在0.000秒内运行了1次测试
失败(错误=1)
$cat test_1.py
导入单元测试
从mycode导入*
类MyFirstTests(unittest.TestCase):
def test_你好(自我):
self.assertEqual(hello\u world(),“hello world”)
def测试(自我):
self.assertEqual(再见世界(),“再见世界”)
unittest.main()
$cat mycode.py
def hello_world():
返回“你好,世界”
def再见_world():
返回“再见世界”