Skip to content

test not running when building on opensuse build server #279

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

Closed
arunpersaud opened this issue Jul 17, 2016 · 11 comments
Closed

test not running when building on opensuse build server #279

arunpersaud opened this issue Jul 17, 2016 · 11 comments

Comments

@arunpersaud
Copy link

Hi

trying to package html5lib for opensuse, but I'm running into the following error when trying to run the tests:

[ 113s] File "/home/abuild/rpmbuild/BUILD/html5lib-0.999999999/html5lib/tests/tokenizertotree.py", line 10, in
[ 113s] from . import test_tokenizer
[ 113s] ImportError: cannot import name 'test_tokenizer'

I can't see that file in the tar-ball or in git over here. Building from the tar-ball on pypi using python 3.5.1.

@gsnedders
Copy link
Member

How are you running the tests? That file appears to be broken, but running the tests as documented shouldn't even try and run that?

@arunpersaud
Copy link
Author

probably running it the wrong way ;) Currently the spec file that builds the rpm does:

 python3 setup.py test

replacing this with "py.test" gives me the following error:

[ 80s] + py.test
[ 80s] ============================= test session starts ==============================
[ 80s] platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
[ 80s] rootdir: /home/abuild/rpmbuild/BUILD/html5lib-0.999999999, inifile: pytest.ini
[ 81s] collected 0 items / 1 errors
[ 81s]
[ 81s] =========================== short test summary info ============================
[ 81s] ERROR
[ 81s] ==================================== ERRORS ====================================
[ 81s] ______________________________ ERROR collecting _______________________________
[ 81s] /usr/lib/python3.5/site-packages/py/_path/common.py:332: in visit
[ 81s] for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
[ 81s] /usr/lib/python3.5/site-packages/py/_path/common.py:378: in gen
[ 81s] for p in self.gen(subdir):
[ 81s] /usr/lib/python3.5/site-packages/py/_path/common.py:367: in gen
[ 81s] dirs = self.optsort([p for p in entries
[ 81s] /usr/lib/python3.5/site-packages/py/_path/common.py:368: in
[ 81s] if p.check(dir=1) and (rec is None or rec(p))])
[ 81s] /usr/lib/python3.5/site-packages/_pytest/main.py:647: in _recurse
[ 81s] ihook = self.gethookproxy(path)
[ 81s] /usr/lib/python3.5/site-packages/_pytest/main.py:550: in gethookproxy
[ 81s] my_conftestmodules = pm._getconftestmodules(fspath)
[ 81s] /usr/lib/python3.5/site-packages/_pytest/config.py:297: in _getconftestmodules
[ 81s] mod = self._importconftest(conftestpath)
[ 81s] /usr/lib/python3.5/site-packages/_pytest/config.py:333: in _importconftest
[ 81s] self.consider_conftest(mod)
[ 81s] /usr/lib/python3.5/site-packages/_pytest/config.py:356: in consider_conftest
[ 81s] if self.register(conftestmodule, name=conftestmodule.file):
[ 81s] /usr/lib/python3.5/site-packages/_pytest/config.py:208: in register
[ 81s] ret = super(PytestPluginManager, self).register(plugin, name)
[ 81s] /usr/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py:370: in register
[ 81s] hook._maybe_apply_history(hookimpl)
[ 81s] /usr/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py:747: in _maybe_apply_history
[ 81s] res = self._hookexec(self, [method], kwargs)
[ 81s] /usr/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py:338: in _hookexec
[ 81s] return self._inner_hookexec(hook, methods, kwargs)
[ 81s] /usr/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py:333: in
[ 81s] _MultiCall(methods, kwargs, hook.spec_opts).execute()
[ 81s] /usr/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py:596: in execute
[ 81s] res = hook_impl.function(*args)
[ 81s] html5lib/tests/conftest.py:31: in pytest_configure
[ 81s] if config.option.update_xfail:
[ 81s] E AttributeError: 'CmdOptions' object has no attribute 'update_xfail'
[ 81s] =========================== 1 error in 0.70 seconds ============================
[ 81s] error: Bad exit status from /var/tmp/rpm-tmp.ErrBZp (%check)
[ 81s]

not sure what's wrong here.

The full build log for one of the architectures can be accessed here:
https://build.opensuse.org/build/home:apersaud:branches:devel:languages:python3/openSUSE_Factory/x86_64/python3-html5lib/_log

@gsnedders
Copy link
Member

You need the requirements given in requirements-test.txt to run the tests.

@arunpersaud
Copy link
Author

added the dependiences: flake8 and pytest-expect were missing (pytest and mock were already included). Still getting the same error as above.
see for example:
https://build.opensuse.org/build/home:apersaud:branches:devel:languages:python3/openSUSE_Factory/i586/python3-html5lib/_log

thanks btw for the fast response ;)

@gsnedders
Copy link
Member

If you're getting the same exception, then it looks like pytest-expect isn't installed. Note there are two packages called pytest-expect, because I suck. (That's gsnedders/pytest-expect#4. Though changing name on package indexes always seem pretty horrible, hence why I keep putting it off…)

(I just get "anonymous_user(Anonymous user is not allowed here - please login):" on the build pages, and until I feel a greater need (i.e., can't just give an answer like the above!) I'm gonna be lazy and not register!)

@gsnedders
Copy link
Member

@arunpersaud did you ever get anywhere with this?

@detrout
Copy link

detrout commented Nov 15, 2016

I was debugging test problems with the Debian packaging for html5lib. After switching from nose to py.test trying to run the tests generated a traceback until I added pytest-expect.

@matejcik
Copy link

I'm still seeing the traceback from #279 (comment) even with pytest-expect present. There doesn't seem to be anything in the code that loads the expect plugin, py.test --trace-config doesn't list it in active plugins. And when added manually with py.test --trace-config -p pytest_expect, it is shown as active but the same traceback still appears.

Is there perhaps some magic option in your global pytest config that you're not telling us about? ;)

@gsnedders
Copy link
Member

Travis at least manages fine, finding the plugin as soon as it is installed! I don't really know beyond that, honestly.

@matejcik
Copy link

Looking at travis instructions actually helped.
Turns out the problem is that pytest-expect depends on u-msgpack-python, which gets pulled automatically when you install with pip, but not when you create dependencies manually in a package manager -- a limitation of our autoconverter tool.

And of course py.test runner hides the failure, surprisingly even in case when you explicitly request the plugin, which i suppose is a pytest bug...

Anyway, adding the missing dependency allows pytest to load the pytest-expect module, which in turn fixes the traceback. Thanks for your time and feel free to close the issue.

@arunpersaud
Copy link
Author

Hi

sorry for the responding, somehow slipped my radar :( Turns out it was the same problem as for matejclk, u-msgpack-python was missing, added it and now everything is working.

Thanks

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

No branches or pull requests

4 participants