I'm familiar with the command py.test -k string for select all tests that contains the string in their name and run it.
What I want is to select tests with more than one string parameter like an OR logical selection. For example, let's say that I have 3 tests:
test_should_connecttest_should_executetest_should_returnAnd let's say I just want to run test_should_connect and test_should_return only.
I've looked for an answer in py.test documentation, and to do that I should use the following command:
py.test -k "connect or return"
But, this doesn't work =/
Run Multiple Tests From a Specific File and Multiple Files To run all the tests from all the files in the folder and subfolders we need to just run the pytest command. This will run all the filenames starting with test_ and the filenames ending with _test in that folder and subfolders under that folder.
Running pytestWe can run a specific test file by giving its name as an argument. A specific function can be run by providing its name after the :: characters. Markers can be used to group tests. A marked grouped of tests is then run with pytest -m .
py.test -k "connect or return" should work. Are you using pytest==2.3.4? Could you paste the output from "py.test" otherwise along with the tests?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With