Skip to content

Improve error messaging when invalid syntax is passed to the -m option#4057

Merged
RonnyPfannschmidt merged 2 commits intopytest-dev:masterfrom
jeffreyrack:4051-improve-error-messaging
Oct 1, 2018
Merged

Improve error messaging when invalid syntax is passed to the -m option#4057
RonnyPfannschmidt merged 2 commits intopytest-dev:masterfrom
jeffreyrack:4051-improve-error-messaging

Conversation

@jeffreyrack
Copy link
Member

Closes #4051

Now when running pytest using the -m option without valid Python syntax, the error message will end with a clear statement as to why:

INTERNALERROR> SyntaxError: unexpected EOF while parsing (<string>, line 1)
INTERNALERROR> Marker expression must be valid Python!

@codecov
Copy link

codecov bot commented Oct 1, 2018

Codecov Report

Merging #4057 into master will decrease coverage by 0.82%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4057      +/-   ##
==========================================
- Coverage   94.47%   93.65%   -0.83%     
==========================================
  Files         109      109              
  Lines       23803    23805       +2     
  Branches     2359     2356       -3     
==========================================
- Hits        22488    22294     -194     
- Misses       1004     1188     +184     
- Partials      311      323      +12
Flag Coverage Δ
#doctesting ?
#linux 93.54% <100%> (-0.79%) ⬇️
#nobyte ?
#numpy ?
#pexpect ?
#py27 91.56% <100%> (-1.04%) ⬇️
#py34 92.01% <100%> (-0.09%) ⬇️
#py35 ?
#py36 91.99% <100%> (-0.68%) ⬇️
#py37 ?
#trial ?
#windows 90.86% <100%> (-2.96%) ⬇️
#xdist ?
Impacted Files Coverage Δ
src/_pytest/mark/legacy.py 98% <100%> (+0.12%) ⬆️
testing/test_mark.py 97.07% <100%> (+0.02%) ⬆️
testing/python/approx.py 79.76% <0%> (-19.85%) ⬇️
testing/test_unittest.py 84.9% <0%> (-14.16%) ⬇️
src/_pytest/unittest.py 74.11% <0%> (-12.36%) ⬇️
src/_pytest/debugging.py 55.81% <0%> (-11.63%) ⬇️
src/_pytest/python_api.py 87.01% <0%> (-10.39%) ⬇️
testing/test_pdb.py 43.86% <0%> (-9.27%) ⬇️
src/_pytest/assertion/util.py 92.92% <0%> (-5.19%) ⬇️
src/_pytest/doctest.py 94.37% <0%> (-2.41%) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8d7f73...7a6d16c. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 93.825% when pulling 7a6d16c on jeffreyrack:4051-improve-error-messaging into d8d7f73 on pytest-dev:master.

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

failure is unrelated and will be fixed by @nicoddemus in another pr
great work on tackling this ripe fruit, thanks 👍

@RonnyPfannschmidt RonnyPfannschmidt merged commit 5d2d64c into pytest-dev:master Oct 1, 2018
@jeffreyrack jeffreyrack deleted the 4051-improve-error-messaging branch April 3, 2019 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants