show a simple and easy error when keyword expressions trigger a syntax error
See original GitHub issueSubmitted this too early, it’s been edited to fix.
Expected behavior: Either: It doesn’t matter if you name a search expression that includes a python keyword Or: A warning not to use python keywords is given instead of an INTERNALERROR.
Actual behavior: If a search term is a python keyword is given, an INTERNALERROR is caused by a SyntaxError exception.
Specifically, this works:
pytest -k <python keyword>
but this does not:
pytest -k 'something or <python keyword>
Examples with no problem:
pytest -k "command or mport"
pytest -k "mport or command"
pytest -k "command or fi"
Examples with a problem
pytest -k "command or import"
pytest -k "import or command"
pytest -k "command or if"
pip list: alabaster (0.7.8) apparmor (2.10.95) appdirs (1.4.3) apt-xapian-index (0.47) apturl (0.5.2) argcomplete (0.8.1) argh (0.26.1) asn1crypto (0.23.0) astroid (1.4.5) attrs (17.3.0) Automat (0.6.0) Babel (2.3.4) backports.shutil-get-terminal-size (1.0.0) beautifulsoup4 (4.4.1) blessings (1.6) blinker (1.3) blist (1.3.6) bpython (0.15) Brlapi (0.6.4) certifi (2017.11.5) cffi (1.11.2) chardet (3.0.4) checkbox-ng (0.23) checkbox-support (0.22) chrome-gnome-shell (0.0.0) click (6.6) colorama (0.3.7) command-not-found (0.3) constantly (15.1.0) cookies (2.2.1) coreapi (2.3.1) coreapi-cli (1.0.6) coreschema (0.0.4) cryptography (2.1.3) curtsies (0.2.6) cycler (0.9.0) decorator (4.0.9) defer (1.0.6) devscripts (2.16.2ubuntu3) dill (0.2.7.1) distribute (0.7.3) distro (1.0.4) docopt (0.6.2) docutils (0.12) entrypoints (0.2.2) exofrills (0.1.12) feedparser (5.1.3) flake8 (3.4.1) flake8-docstrings (1.1.0) flake8-polyfill (1.0.1) future (0.16.0) greenlet (0.4.9) guacamole (0.9.2) haxor-news (0.4.1) html5lib (0.999) httplib2 (0.9.1) hyperlink (17.3.1) idna (2.6) imagesize (0.7.1) incremental (17.5.0) ipykernel (4.3.1) ipython (4.2.0) ipython-genutils (0.1.0) itypes (1.1.0) jedi (0.10.2) Jinja2 (2.8) jsonschema (2.5.1) jupyter-client (4.2.2) jupyter-core (4.1.0) language-selector (0.1) lazy-object-proxy (1.2.2) LibAppArmor (2.10.95) lightdm-gtk-greeter-settings (1.2.1) louis (2.6.4) lxml (3.5.0) Magic-file-extensions (0.2) Mako (1.0.3) MarkupSafe (0.23) matplotlib (1.5.1) mccabe (0.6.1) MinimalModbus (0.7) mistune (0.7.2) modbus-tk (0.5.8) multiprocess (0.70.5) nbconvert (4.2.0) nbformat (4.0.1) networkx (1.11) nose (1.3.7) npyscreen (4.10.5) numexpr (2.6.4) numpy (1.13.3) oauthlib (1.0.3) onboard (1.2.0) oneconf (0.3.9) packaging (16.8) padme (1.1.1) pandas (0.21.0) PasteDeploy (1.5.2) pathos (0.2.1) pathtools (0.1.2) pep8 (1.7.0) pexpect (4.1.0) pickleshare (0.7.2) Pillow (3.1.2) pip (9.0.1) piston-mini-client (0.7.5) plainbox (0.25) pox (0.2.3) ppft (1.6.4.7.1) prompt-toolkit (1.0.15) protobuf (3.3.0) psutil (4.2.0) ptpython (0.41) ptyprocess (0.5.1) py (1.5.2) py3-ortools-ubuntu-16.04 (6.3.4431) pyarrow (0.7.1) pyasn1 (0.1.9) pycodestyle (2.3.1) pycparser (2.18) pycrypto (2.6.1) pycups (1.9.73) pycurl (7.43.0) pydocstyle (2.0.0) pyflakes (1.5.0) Pygments (2.2.0) pygments-style-cheerfully-dark (0.1) pygobject (3.20.0) PyJWT (1.3.0) pylama (7.4.1) pylast (1.0.0) pylint (1.5.5) pymodbus3 (1.0.0) PyMySQL (0.7.2) pyOpenSSL (17.3.0) pyparsing (2.2.0) pyramid (1.7) pyramid-redis (0.1.4) pyserial (3.4) pysmbc (1.0.15.5) pytest (3.2.5) python-apt (1.1.0b1) python-dateutil (2.6.1) python-debian (0.1.27) python-systemd (231) pytz (2017.3) pyxdg (0.25) PyYAML (3.12) pyzmq (15.2.0) QtAwesome (0.4.4) qtconsole (4.2.1) QtPy (1.3.1) quilt (2.7.1, /home/silver/Projects/Work/quilt) redis (2.10.6) reportlab (3.3.0) repoze.lru (0.6) requests (2.18.4) responses (0.6.0) roman (2.0.0) rope (0.10.3) rope-py3k (0.9.4.post1) scipy (0.17.0) screen-resolution-extra (0.0.0) sessioninstaller (0.0.0) setproctitle (1.1.10) setuptools (38.1.0) sh (1.12.14) simplegeneric (0.8.1) six (1.11.0) snowballstemmer (1.2.1) software-center-aptd-plugins (0.0.0) Sphinx (1.4.1) sphinx-rtd-theme (0.1.9) spyder (2.3.8) SQLAlchemy (1.0.11) ssh-import-id (5.5) system-service (0.3) tables (3.4.2) tornado (4.3) tqdm (4.19.4) traitlets (4.2.1) translationstring (1.3) Twisted (17.9.0) ubuntu-drivers-common (0.0.0) ufw (0.35) unattended-upgrades (0.1) unity-scope-audacious (0.1) unity-scope-calculator (0.1) unity-scope-chromiumbookmarks (0.1) unity-scope-clementine (0.1) unity-scope-colourlovers (0.1) unity-scope-devhelp (0.1) unity-scope-firefoxbookmarks (0.1) unity-scope-gdrive (0.7) unity-scope-gmusicbrowser (0.1) unity-scope-gourmet (0.1) unity-scope-guayadeque (0.1) unity-scope-manpages (0.1) unity-scope-musique (0.1) unity-scope-openclipart (0.1) unity-scope-texdoc (0.1) unity-scope-tomboy (0.1) unity-scope-virtualbox (0.1) unity-scope-yelp (0.1) unity-scope-zotero (0.1) uritemplate (3.0.0) urllib3 (1.22) urwid (1.3.1) usb-creator (0.3.0) venusian (1.0) virtualenv (15.0.1) watchdog (0.8.3) wcwidth (0.1.7) WebOb (1.6.1) wheel (0.29.0) wrapt (1.10.8) xdiagnose (3.8.4.1) xkit (0.0.0) xlrd (1.1.0) XlsxWriter (0.7.3) xonsh (0.5.12) zope.component (4.4.0) zope.deprecation (4.1.2) zope.event (4.3.0) zope.interface (4.4.3)
Pytest version:
This is pytest version 3.2.5, imported from /usr/local/lib/python3.5/dist-packages/pytest.py
setuptools registered plugins:
xonsh-0.5.12 at /usr/local/lib/python3.5/dist-packages/xonsh/pytest_plugin.py
pylama-7.4.1 at /usr/local/lib/python3.5/dist-packages/pylama/pytest.py
OS Version: Ubuntu 16.04.3 LTS
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Yes, please do the honors @feuillemorte!
Pull request was merged. Should we close this task?