【问题标题】:Unable to run tests with pytest-bdd 4.1.0 and python 3.7.5无法使用 pytest-bdd 4.1.0 和 python 3.7.5 运行测试
【发布时间】:2021-09-28 21:32:04
【问题描述】:

我使用的是 python 3.4.4 和 pytes-bdd 3.1.0,我能够使用以下命令执行测试用例

pytest-bdd -sv test_tc.py

但是由于我已经开始使用 python 3.7.5 和 pytest-bdd 4.1.0 那么如果我使用上面的命令,我会收到以下错误

pytest-bdd: error: argument command: invalid choice: test_tc.py (choose from ;migrate', 'generate')

【问题讨论】:

    标签: python python-3.x pytest


    【解决方案1】:

    您似乎在混合使用命令pytest 和命令pytest-bdd,因为参数-sv test_tx.py 用于pytest。试试这个:

    pytest -sv test_tc.py
    

    基于docs 和pytest-bdd 的--help,它只接受migrate 或generate:

    pytest-bdd generate features/some.feature > tests/functional/test_some.py
    

    【讨论】:

      猜你喜欢
      • 2017-08-08
      • 2021-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-04
      • 1970-01-01
      相关资源
      最近更新 更多