Python 使用proboscis运行测试的工作示例
我创建了一个Python 使用proboscis运行测试的工作示例,python,python-2.7,python-3.x,Python,Python 2.7,Python 3.x,我创建了一个first.py文件,其中包含以下代码。然后通过右键单击first.py并点击run按钮,从Pycharm的命令提示符(或)以pythonfirst.py的形式运行它。我看到了下面的输出 我希望test1()函数运行并通过。为什么我的测试没有运行 输出: first.py内容: 您在哪里首先调用函数py?下面是“添加编辑的代码”,它可以工作。 添加了测试程序代码 from proboscis import test from proboscis import asserts from
first.py
文件,其中包含以下代码。然后通过右键单击first.py
并点击run按钮,从Pycharm的命令提示符(或)以pythonfirst.py
的形式运行它。我看到了下面的输出
我希望test1()
函数运行并通过。为什么我的测试没有运行
输出:
first.py内容:
您在哪里首先调用函数
py
?下面是“添加编辑的代码”,它可以工作。
添加了测试程序代码
from proboscis import test
from proboscis import asserts
from proboscis import TestProgram
@test()
def test1():
asserts.assert_equal(1, 1)
TestProgram().run_and_exit()
输出为:
C:\Python\python.exe first.py
proboscis.case.FunctionTest (test1) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
Process finished with exit code 0
您在哪里首先调用函数py
?下面是“添加编辑的代码”,它可以工作。
添加了测试程序代码
from proboscis import test
from proboscis import asserts
from proboscis import TestProgram
@test()
def test1():
asserts.assert_equal(1, 1)
TestProgram().run_and_exit()
输出为:
C:\Python\python.exe first.py
proboscis.case.FunctionTest (test1) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
Process finished with exit code 0
你用字符串测试过assert_equal()吗?@ArashHatami,我现在做的assert肯定没有问题。即使我说,asserts.assert_equal(“1”,“1”),我仍然有同样的问题。你用字符串测试assert_equal()了吗?@ArashHatami,我现在做的assert肯定没有问题。即使我说,asserts.assert_equal(“1”,“1”),我仍然有同样的问题。