kevlened / pytest-parallel

A pytest plugin for parallel and concurrent testing
https://github.com/browsertron/pytest-parallel/issues/104#issuecomment-1293941066
MIT License
313 stars 60 forks source link

file not found: --tests-per-worker 4 #30

Closed WilliamsChueh closed 4 years ago

WilliamsChueh commented 5 years ago

I used command line to execute is working.(ex. pytest --tests-per-worker 4) But if i used pytest.main(['--tests-per-worker 4']) to execute will be fail. Fail message is below (Enviroment:Windows 7)

plugins: xdist-1.26.1, parallel-0.0.9, metadata-1.8.0, json-report-1.0.3, forked-1.0.2 collecting ... =================================================================================================== no tests ran in 0.00 seconds =================================================================================================== ERROR: file not found: --tests-per-worker 4

Code def test_Execute(): pytest.main(['--tests-per-worker 4'])

if name == 'main': test_Execute()

matsapo commented 5 years ago

I can reproduce this.

I first tried using this plugin by passing its parameters through pytest.main and it complains that the file cannot be found. Using it through the command line seems to work fine.

blueyed commented 4 years ago

pytest.main(['--tests-per-worker 4'])

You are using a single argument there, try/use ['--tests-per-worker', '4'].

kevlened commented 4 years ago

@blueyed is correct. Please reply if the issue persists.