Python-behave 标签的 Or 逻辑似乎不起作用

Python-behave tag's Or logic does not appear to be working

Feature: Addition tests

@one
Scenario: Add two numbers to pass
  Given two numbers to add
  When 2 and 3 are added together
  Then the sum should be 5

@two
  Scenario: Add two numbers to fail
  Given two numbers to add
  When 2 and 3 are added together
  Then the sum should be 6

运行 >> 行为 --tags="@one" (或行为 --tags=one) 给我

@one
Scenario: Add two numbers to pass  # features/Add.feature:4
  Given two numbers to add         # features/steps/Maths.py:4 0.000s
  When 2 and 3 are added together  # features/steps/Maths.py:8 0.000s
  Then the sum should be 5         # features/steps/Maths.py:12 0.000s

 @two
 Scenario: Add two numbers to fail  # features/Add.feature:10
   Given two numbers to add         # None
   When 2 and 3 are added together  # None
   Then the sum should be 6         # None

符合预期。

还 运行 >> 表现 --tags="@one 或 @two" 给我

@one
Scenario: Add two numbers to pass  # features/Add.feature:4
  Given two numbers to add         # None
  When 2 and 3 are added together  # None
  Then the sum should be 5         # None

@two
Scenario: Add two numbers to fail  # features/Add.feature:10
  Given two numbers to add         # None
  When 2 and 3 are added together  # None
  Then the sum should be 6         # None

这应该执行两个场景,并且根据每个教程,这似乎是 运行 多个场景的方式。我是否遗漏了一些明显的东西(而且我肯定 运行宁 "or" 而不是表现 --tags="@one 和 @two")?

不是答案,我还不能发表评论。

我遇到了类似的问题。

behave --tags="@one and @two"

运行 "and" ^^^ 似乎跳过了所有测试,即使我的测试肯定有两个标签。

虽然此功能已记录在 latest version documentation, it is not available in the stable version, which at the time of writing this answer is 1.2.6. Your issue has been documented a while ago in github and closed 中。

您可能安装了 1.2.6 或更低版本,在这种情况下,您应该使用以下之一进行逻辑或:

behave --tags=one,two

#that's the same thing as
behave --tags @one,@two

behave --tags-help 也提供了一些有用的信息。

如果您想升级,请卸载当前 behave 版本并安装最新的可用标记版本(此时为 v1.2.7.v1)。

sudo pip uninstall behave
pip install git+https://github.com/behave/behave@v1.2.7.v1

说明和其他安装选项here