-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Originally reported by: Brianna Laugher (BitBucket: pfctdayelise, GitHub: pfctdayelise)
Using platform linux2 -- Python 2.7.5 -- pytest-2.3.5
I suspect this is related to the changes in d16cc2d which went into 2.3.4. Basically I find it a lot harder now to select tests, especially parametrised ones.
Here are some examples:
#!shell
$py.test tests/system/combined/test_marineWindWarnings.py --collectonly
=============== test session starts ===============
platform linux2 -- Python 2.7.5 -- pytest-2.3.5
plugins: xdist, cov
collected 6 items
<Module 'tests/system/combined/test_marineWindWarnings.py'>
<Function 'test_windSpeedsTreatedConsistently[25.4-<None>-25]'>
<Function 'test_windSpeedsTreatedConsistently[25.5-CW1.W:STR-30]'>
<Function 'test_windSpeedsTreatedConsistently[33.4-CW1.W:STR-30]'>
<Function 'test_windSpeedsTreatedConsistently[33.5-CW1.W:GALE-35]'>
<Function 'test_windSpeedsTreatedConsistently[63.4-CW1.W:STO-60]'>
<Function 'test_windSpeedsTreatedConsistently[63.5-CW1.W:HURR-65]'>
- If I run
-k 'None', I get no tests selected (rather than 1). - If I run
-k '<None>', I get a SyntaxError! - If I run
-k '33.4', I get 6 tests run! No idea why. Same with '25.4'. And even '25'. I have no idea how it is handling numbers. - If I run
-k 'test_windSpeedsTreatedConsistently[33.4-CW1.W:STR-30]'(which is what I used to do) I get another SyntaxError that shows that my string has been changed totest_windSpeedsTreatedConsistently[33.4not CW1.W:STRnot 30].
It seems to me at the moment there is no way I can select only this first test.
To be honest, I really prefer the old behaviour of -k. Being able to run collectonly and then copy a test name into -k was useful.
Related, I can't find an explanation in the documentation about which characters/words are "special" and not treated as a flat string. Am I writing a regexp? I can see "-" is converted to "not"; what about other punctuation?
The usage docs say
#!python
py.test -k string # only run tests whose names contain a string
which is basically not true right now.