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

Fail hard with tracebacks if pytest-expect isn't working #360

Merged
merged 1 commit into from
Nov 21, 2017
Merged

Fail hard with tracebacks if pytest-expect isn't working #360

merged 1 commit into from
Nov 21, 2017

Conversation

willkg
Copy link
Contributor

@willkg willkg commented Nov 9, 2017

Fixes #329

If you run pytest without pytest-expect or u-msgpack-python, then it'll show something like this:

$ pytest
======================================================= test session starts ========================================================
platform linux2 -- Python 2.7.13, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/willkg/mozilla/html5lib-python, inifile: pytest.ini

******************************************************************************
ERROR: Either pytest-expect or its dependency u-msgpack-python is not
installed. Please install them both before running pytest.
******************************************************************************

collected 0 items / 1 errors                                                                                                        

===================================================== short test summary info ======================================================
ERROR 
============================================================== ERRORS ==============================================================
________________________________________________________ ERROR collecting  _________________________________________________________
../../.virtualenvs/html5lib/local/lib/python2.7/site-packages/py/_path/common.py:372: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
../../.virtualenvs/html5lib/local/lib/python2.7/site-packages/py/_path/common.py:421: in gen
    for p in self.gen(subdir):
../../.virtualenvs/html5lib/local/lib/python2.7/site-packages/py/_path/common.py:411: in gen
    if p.check(dir=1) and (rec is None or rec(p))])
../../.virtualenvs/html5lib/local/lib/python2.7/site-packages/_pytest/main.py:728: in _recurse
    ihook = self.gethookproxy(path)
../../.virtualenvs/html5lib/local/lib/python2.7/site-packages/_pytest/main.py:632: in gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
../../.virtualenvs/html5lib/local/lib/python2.7/site-packages/_pytest/config.py:356: in _getconftestmodules
    mod = self._importconftest(conftestpath)
../../.virtualenvs/html5lib/local/lib/python2.7/site-packages/_pytest/config.py:381: in _importconftest
    raise ConftestImportFailure(conftestpath, sys.exc_info())
E   ConftestImportFailure: ImportError('No module named umsgpack',)
E     File "/home/willkg/.virtualenvs/html5lib/local/lib/python2.7/site-packages/_pytest/assertion/rewrite.py", line 212, in load_module
E       py.builtin.exec_(co, mod.__dict__)
E     File "/home/willkg/.virtualenvs/html5lib/local/lib/python2.7/site-packages/py/_builtin.py", line 221, in exec_
E       exec2(obj, globals, locals)
E     File "<string>", line 7, in exec2
E     File "/home/willkg/mozilla/html5lib-python/html5lib/tests/conftest.py", line 37, in <module>
E       fail_if_missing_pytest_expect()
E     File "/home/willkg/mozilla/html5lib-python/html5lib/tests/conftest.py", line 23, in fail_if_missing_pytest_expect
E       from pytest_expect import expect  # noqa
E     File "/home/willkg/.virtualenvs/html5lib/local/lib/python2.7/site-packages/_pytest/assertion/rewrite.py", line 212, in load_module
E       py.builtin.exec_(co, mod.__dict__)
E     File "/home/willkg/.virtualenvs/html5lib/local/lib/python2.7/site-packages/py/_builtin.py", line 221, in exec_
E       exec2(obj, globals, locals)
E     File "<string>", line 7, in exec2
E     File "/home/willkg/.virtualenvs/html5lib/local/lib/python2.7/site-packages/pytest_expect/expect.py", line 18, in <module>
E       import umsgpack
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================== 1 error in 0.24 seconds ======================================================

@willkg willkg requested a review from gsnedders November 9, 2017 17:08
@willkg willkg added this to the 1.0 milestone Nov 9, 2017
@willkg
Copy link
Contributor Author

willkg commented Nov 9, 2017

@gsnedders Does this match what you were thinking?

@gsnedders
Copy link
Member

gsnedders commented Nov 9, 2017

@willkg Yes. (Feel free to ping me if I haven't reviewed this within a week.)

@gsnedders gsnedders merged commit 2afc3ad into html5lib:master Nov 21, 2017
@willkg willkg deleted the 329-pytest-expect branch December 4, 2017 14:03
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.

None yet

2 participants