I’m trying to contribute to the YouTube extension and I have some problems.
I’m new to Python development and Mopidy so the questions will probably sound trivial, bear with me
First, I’d like to run the existing tests and create a new one. I go to the tests folder and type py.test. I get an error when import pafy is found in test_backend.py.
When I try to install it, it seems it is already installed. I followed all the steps on the main documention (good job btw, really clear) to set up my environment so I’m not sure why I get this error.
Can anybody help me with this?
I’m sure I will have other generic questions about the developement workflow before I’m on my way.
Cross posting from: https://github.com/mopidy/mopidy-youtube/issues/62
The Mopidy project itself and most of the extensions rely on tox. So you probably need to type tox -e py27 to start the tox environment up and run the tests.
Because tox is a generic virtual environment specifically geared towards automated testing it should take care of all of the dependencies for you, which should make the pafy issue go away as well.
There are tox plugins available for py.test but I don’t think they would have been configured for this project.
Thanks for the answer. I just tried using tox, and no dice :-/
I can’t diagnose this on my own and googling the error message didnt help, so maybe I can get some assistance again.
This is what I get:
(mopidy) pi@raspberrypi:~/mopidy-dev/mopidy-youtube $ tox -e py27
GLOB sdist-make: /home/pi/mopidy-dev/mopidy-youtube/setup.py
py27 inst-nodeps: /home/pi/mopidy-dev/mopidy-youtube/.tox/dist/Mopidy-Youtube-2.0.2.zip
py27 installed: loads of stuff
py27 runtests: PYTHONHASHSEED='...'
py27 runtests: commands | py.test --basetemp=/home/pi/mopidy-dev/mopidy-youtube/.tox/py27/tmp --junit-xml=xunit-py27.xml --cov=mopidy_youtube --cov-report=term-missing
WARNING:test command found but not installed in testenv
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
========= test session starts ========
platform linux2 -- Python 2.7.9, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /home/pi/mopidy-dev/mopidy-youtube, inifile:
plugins: capturelog-0.7, cov-2.2.1, xdist-1.14
collected 1 items / 1 errors
---------- generated xml file: ...27.xml ----------
====== ERRORS ======
______ ERROR collecting tests/test_backend.py ____
tests/test_backend.py:5: in <module>
E ImportError: No module named pafy
===== 1 passed, 1 pytest-warnings, 1 error in 1.72 seconds =======
Exception TypeError: "'NoneType' object is not callable" in <function _removeHandlerRef at 0x7636c1f0> ignored
ERROR: InvocationError: '/usr/local/bin/py.test --basetemp=/home/pi/mopidy-dev/mopidy-youtube/.tox/py27/tmp --junit-xml=xunit-py27.xml --cov=mopidy_youtube --cov-report=term-missing'
______ summary _______
ERROR: py27: commands failed
I’m not sure why I’m getting this, and hopefully that will be of use to others.