pkulev / xoinvader

Python space game in terminal
http://mmap.me
MIT License
12 stars 1 forks source link

`make view_cov` fails when pygame is not installed #39

Closed alex-eg closed 7 years ago

alex-eg commented 7 years ago

Annoying bug.

pkulev commented 7 years ago

Trace please

alex-eg commented 7 years ago
================================= test session starts =================================
platform linux -- Python 3.4.5, pytest-3.0.5, py-1.4.32, pluggy-0.4.0 -- /home/ex/dev/xoinvader/.venv/bin/python3
cachedir: .cache
rootdir: /home/ex/dev/xoinvader, inifile: 
plugins: cov-2.4.0
collected 22 items / 2 errors 

----------- coverage: platform linux, python 3.4.5-final-0 -----------
Coverage HTML written to dir htmlcov

======================================= ERRORS ========================================
________________ ERROR collecting xoinvader/tests/test_application.py _________________
ImportError while importing test module '/home/ex/dev/xoinvader/xoinvader/tests/test_application.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
xoinvader/tests/test_application.py:3: in <module>
    import pygame
E   ImportError: No module named 'pygame'
___________________ ERROR collecting xoinvader/tests/test_weapon.py ___________________
ImportError while importing test module '/home/ex/dev/xoinvader/xoinvader/tests/test_weapon.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
xoinvader/tests/test_weapon.py:4: in <module>
    from xoinvader import weapon
xoinvader/weapon.py:9: in <module>
    from xoinvader.sound import Mixer
xoinvader/sound.py:46: in <module>
    class PygameMixer(object, metaclass=Singleton):
xoinvader/sound.py:49: in PygameMixer
    import pygame
E   ImportError: No module named 'pygame'
!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!
=============================== 2 error in 0.83 seconds ===============================
make: *** [Makefile:33: test] Error 2
alex-eg commented 7 years ago

Quick&dirty workaround is to delete two failing tests.

pkulev commented 7 years ago

This is not bug. What complete coverage you want to get without pygame? I can try to mark this tests as graphic and provide command to run tests without pygame. As solution emerge pygame and recreate venv with --system-site-packages.

alex-eg commented 7 years ago

recreate venv with --system-site-packages

Okay. pygame is isntalled, btw.

alex-eg commented 7 years ago

Also I think that if pygame is not installed, tests that are depending on it should be skipped. Or at least there should be some message about it.