Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra space in INI markers section causes inconsistent behavior #2856

Closed
greg78731 opened this issue Oct 21, 2017 · 3 comments · Fixed by #2867
Closed

extra space in INI markers section causes inconsistent behavior #2856

greg78731 opened this issue Oct 21, 2017 · 3 comments · Fixed by #2867
Labels
good first issue easy issue that is friendly to new contributor type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed

Comments

@greg78731
Copy link

In the markers section of the INI file, if you include an extra space between the marker and the colon, the pytest --markers command lists the marker, however the running pytest -m mymarker causes an "Attribute Error: 'mymarker' not a registered marker.

pytest.ini example:

[pytest] 
addopts = -rsxX -l --strict -v -x

markers = 
	incomplete: tests which are not complete
	dev : tests in development
	complete: tests which are complete
	noDbUpdate: tests which do not update the database

filterwarnings =
    ignore

NOTE: There's an extra space between dev and the colon.

pytest --markers lists:

> pytest --markers
@pytest.mark.incomplete: tests which are not complete

@pytest.mark.dev : tests in development

@pytest.mark.complete: tests which are complete

@pytest.mark.noDbUpdate: tests which do not update the database

pytest -m dev generates:

>pytest -m dev
============================= test session starts =============================
platform win32 -- Python 3.4.3, pytest-3.2.3, py-1.4.34, pluggy-0.4.0 -- c:\python34\python.exe
cachedir: .cache
rootdir: C:\Users\Greg\...\tests, inifile: pytest.ini
collecting 0 items / 1 errors
=================================== ERRORS ====================================
___________________ ERROR collecting test_createShipment.py ___________________
test_createShipment.py:127: in <module>
    @pytest.mark.dev
c:\python34\lib\site-packages\_pytest\mark.py:264: in __getattr__
    self._check(name)
c:\python34\lib\site-packages\_pytest\mark.py:279: in _check
    raise AttributeError("%r not a registered marker" % (name,))
E   AttributeError: 'dev' not a registered marker
!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 1.06 seconds ===========================

Version info:
Python 3.4.3 running on Windows 10.0.14393
pytest version 3.2.3

@RonnyPfannschmidt RonnyPfannschmidt added type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed labels Oct 21, 2017
@nicoddemus
Copy link
Member

Why do you consider this a backward compatibility issue @RonnyPfannschmidt ? I find it hard to believe somebody actually depends on that behavior...

@nicoddemus nicoddemus added Hacktoberfest good first issue easy issue that is friendly to new contributor labels Oct 23, 2017
@RonnyPfannschmidt
Copy link
Member

@nicoddemus yes - but we are bascially going to change a parser and the fix may break other working code ^^

@nicoddemus
Copy link
Member

OK I see what you mean. So this probably belongs in the features branch.

@RonnyPfannschmidt RonnyPfannschmidt added the type: feature-branch new feature or API change, should be merged into features branch label Oct 24, 2017
@nicoddemus nicoddemus removed the type: feature-branch new feature or API change, should be merged into features branch label Oct 24, 2017
Perlence added a commit to Perlence/pytest that referenced this issue Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue easy issue that is friendly to new contributor type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants