使用pytest-xdist运行测试用例,执行命令 pytest -n 2,执行时只有一个进程在执行。Python的版本:3.9.6,pytest-xdist插件版本:2.5.0。求解答
执行命令
PS D:\daima-tool> pytest -n 2 .\test_case.py
执行的结果
platform win32 -- Python 3.9.6, pytest-7.0.1, pluggy-1.0.0 -- D:\Python\python39.exe
cachedir: .pytest_cache
metadata: {'Python': '3.9.6', 'Platform': 'Windows-10-10.0.19045-SP0', 'Packages': {'pytest': '7.0.1', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'allure-pytest'
: '2.9.45', 'forked': '1.4.0', 'html': '3.1.1', 'metadata': '2.0.1', 'ordering': '0.6', 'rerunfailures': '10.2', 'xdist': '2.5.0'}, 'JAVA_HOME': 'D:\\java'}
rootdir: D:\daima-tool\controller-test, configfile: pytest.ini
plugins: allure-pytest-2.9.45, forked-1.4.0, html-3.1.1, metadata-2.0.1, ordering-0.6, rerunfailures-10.2, xdist-2.5.0
[gw0] win32 Python 3.9.6 cwd: D:\daima-tool\controller-test
[gw1] win32 Python 3.9.6 cwd: D:\daima-tool\controller-test
[gw0] Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
[gw1] Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
gw0 [2551] / gw1 [2551]
scheduling tests via LoadScopeScheduling
test_case.py::Test::test_voice[case0]
[gw0] [ 0%] FAILED test_case.py::Test::test_voice[case0]
test_case.py::Test::test_voice[case1]
[gw0] [ 0%] PASSED test_case.py::Test::test_voice[case1]
test_case.py::Test::test_voice[case2]
[gw0] [ 0%] FAILED test_case.py::Test::test_voice[case2]
test_case.py::Test::test_voice[case3]
[gw0] [ 0%] PASSED test_case.py::Test::test_voice[case3]
test_case.py::Test::test_voice[case4]
[gw0] [ 0%] PASSED test_case.py::Test::test_voice[case4]
test_case.py::Test::test_voice[case5]
[gw0] [ 0%] PASSED test_case.py::Test::test_voice[case5]
test_case.py::Test::test_voice[case6]
[gw0] [ 0%] PASSED test_case.py::Test::test_voice[case6]