You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some test methods named test_01_login_subscribe and test_02_failed_subscription (among others with different numbers). If I want to run the first, I can execute either of the following commands and it will only run test_01_login_subscribe. The same idea applies to the second test.
pytest -k test_01
pytest -k 01
I can also run both tests and no others by using one of these commands:
pytest -k "test_01 or test_02"
pytest -k "_01 or _02"
The following command, however, does not work. When I run this command, every single test in my suite is triggered:
pytest -k "01 or 02"
The following commands raise an exception:
pytest2 -k "01_ or 02_"
pytest2 -k "01_login_subscribe or 02_failed_subscription"
Here is the full output for the above command:
============================= test session starts =============================
platform win32 -- Python 2.7.14, pytest-3.2.3, py-1.4.34, pluggy-0.4.0 -- c:\python27\python.exe
cachedir: .cache
rootdir: C:\...\test, inifile: pytest.ini
collected 52 items
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\main.py", line 110, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\main.py", line 145, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745, in __call__
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334, in <lambda>
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 614, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\main.py", line 155, in pytest_collection
INTERNALERROR> return session.perform_collect()
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\main.py", line 648, in perform_collect
INTERNALERROR> config=self.config, items=items)
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745, in __call__
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334, in <lambda>
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 614, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\mark.py", line 151, in pytest_collection_modifyitems
INTERNALERROR> if keywordexpr and not matchkeyword(colitem, keywordexpr):
INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\mark.py", line 234, in matchkeyword
INTERNALERROR> return eval(keywordexpr, {}, mapping)
INTERNALERROR> File "<string>", line 1
INTERNALERROR> 01_login_subscribe or 02_failed_subscription
INTERNALERROR> ^
INTERNALERROR> SyntaxError: invalid syntax
The text was updated successfully, but these errors were encountered:
dnut
changed the title
-k option matches anything with strings starting with numbers
-k option matches strings starting with numbers with all tests
Nov 18, 2017
dnut
changed the title
-k option matches strings starting with numbers with all tests
-k option cannot handle strings starting with a number that contain spaces
Nov 18, 2017
dnut
changed the title
-k option cannot handle strings starting with a number that contain spaces
-k cannot handle strings containing spaces that start with a number
Nov 18, 2017
Uh oh!
There was an error while loading. Please reload this page.
Windows 10 x64
Python v2.7.14:84471935ed, Sep 16 2017, 20:25:58
pytest 3.2.3
I have some test methods named test_01_login_subscribe and test_02_failed_subscription (among others with different numbers). If I want to run the first, I can execute either of the following commands and it will only run test_01_login_subscribe. The same idea applies to the second test.
I can also run both tests and no others by using one of these commands:
The following command, however, does not work. When I run this command, every single test in my suite is triggered:
The following commands raise an exception:
Here is the full output for the above command:
The text was updated successfully, but these errors were encountered: