我有一些使用 conftest 中定义的夹具的参数化测试。使用 pytest-xdist 但使用标准 pytest 通过时,我的测试失败。夹具创建了一个目录,然后由测试使用,我得到了 IOErrors。
从输出中,看起来两个失败的参数化测试要么被收集和/或被多次运行。请注意,在下面的输出中 test_save_load[obj2] 和 test_save_load[obj0] 失败并且它们出现了两次,所以我假设它们正在运行多次。我可以以不同的方式编写测试以不进行参数化;但很想了解这个问题。任何关于正在发生的事情或 pytest-xdist 如何帮助理解问题的想法将不胜感激。
谢谢!
这是我的输出片段:
platform darwin -- Python 2.7.6 -- pytest-2.5.1 --
plugins: xdist
[gw0] darwin Python 2.7.6 cwd: /tests/unit_tests
[gw1] darwin Python 2.7.6 cwd: /tests/unit_tests
[gw2] darwin Python 2.7.6 cwd: /tests/unit_tests
[gw3] darwin Python 2.7.6 cwd: /tests/unit_tests
[gw0] Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) -- [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
[gw2] Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) -- [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
[gw1] Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) -- [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
[gw3] Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) -- [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
gw0 [30] / gw1 [30] / gw2 [30] / gw3 [30]
scheduling tests via LoadScheduling
test_save_load.py:17: test_exceptions
test_save_load.py:135: test_save_load[obj0]
test_save_load.py:45: test_gnome_obj_reference
test_save_load.py:135: test_save_load[obj2]
[gw3] PASSED test_save_load.py:17: test_exceptions
[gw1] PASSED test_save_load.py:45: test_gnome_obj_reference
test_save_load.py:31: test_reference_object
[gw3] PASSED test_save_load.py:31: test_reference_object
test_save_load.py:73: test_savloc_created
test_save_load.py:135: test_save_load[obj4]
[gw1] PASSED test_save_load.py:73: test_savloc_created
test_save_load.py:135: test_save_load[obj5]
[gw3] PASSED test_save_load.py:135: test_save_load[obj4]
test_save_load.py:135: test_save_load[obj6]
[gw2] FAILED test_save_load.py:135: test_save_load[obj2]
[gw0] FAILED test_save_load.py:135: test_save_load[obj0]