【问题标题】:Python Behave tests work and then stop working and then work without changePython Behave 测试工作,然后停止工作,然后继续工作而不做任何改变
【发布时间】:2018-05-01 16:39:50
【问题描述】:

我有一个简单的功能,我传递了 2 个示例。

Background: I create context params calls
Given I create context params calls
And I populate default array1
And I populate default array2

Scenario Outline: I enter x array <a> and <b> and <c> and <d> and <e> and <f>and <g> and <h> and <i> and <j> and <k> and <l>
Given I have a a array <a>
And I have a b array <b>
And I have a c array <c>
And I have a d array <d>
And I have a e array <e>
When I call the interface
Then I will see <f> <g> <h> <i> <j> <k> <l>

当我运行测试时,它可能会在我第一次在命令行中键入行为时起作用,或者它可能在我第三次或第七次在命令行中键入行为命令时起作用。 起初我以为这是我的本地设置,所以我转移到另一台计算机并安装了行为,同样的问题发生了。我认为这是我的步骤文件的错误,但我得到的唯一错误是:

Exception OSError: raw write() returned invalid length 1508 (should have been between 0 and 754)
Traceback (most recent call last):
File "\lib\runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "\Scripts\behave.exe\__main__.py", line 9, in <module>
File "\lib\site-packages\behave\__main__.py", line 183, in main
return run_behave(config)
File "\lib\site-packages\behave\__main__.py", line 127, in run_behave
failed = runner.run()
File "\lib\site-packages\behave\runner.py", line 804, in run
return self.run_with_paths()
File "\lib\site-packages\behave\runner.py", line 824, in run_with_paths
return self.run_model()
File "\lib\site-packages\behave\runner.py", line 626, in run_model
failed = feature.run(self)
File "\lib\site-packages\behave\model.py", line 321, in run
failed = scenario.run(runner)
File "\lib\site-packages\behave\model.py", line 1114, in run
failed = scenario.run(runner)
File "c\lib\site-packages\behave\model.py", line 711, in run
if not step.run(runner):
File "\lib\site-packages\behave\model.py", line 1311, in run
formatter.match(match)
File "\lib\site-packages\behave\formatter\pretty.py", line 130, in match
self.print_statement()
File "lib\site-packages\behave\formatter\pretty.py", line 265, in  print_statement
self.stream.write("\n")
OSError: raw write() returned invalid length 1508 (should have been between 0 and 754)

目前我认为这与我的 steps.py 未正确初始化有关,但为什么在多次输入行为命令后它会起作用?有没有人知道如何解决这个问题?

【问题讨论】:

    标签: python-behave


    【解决方案1】:

    我在使用 pycharm 终端时发现了https://github.com/Microsoft/vscode/issues/39149,我相信我遇到了这个问题。当我切换到本机终端时,它每次都会运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-01
      • 1970-01-01
      • 2011-11-13
      • 2020-02-21
      • 1970-01-01
      相关资源
      最近更新 更多