joeyespo / pytest-watch

Local continuous test runner with pytest and watchdog.
MIT License
737 stars 52 forks source link

ptw fails to start on ModuleNotFoundError: #85

Closed PhE closed 6 years ago

PhE commented 6 years ago

ptw exits immediately if there an import error like :

import not_found

def test_100():
    assert True

But if ptw starts with no error, then the same import error is correctly displayed (and ptw continues to run as expected) :

Running: py.test
============================================================================================================= test session starts =============================================================================================================
platform linux -- Python 3.6.3, pytest-3.0.7, py-1.5.2, pluggy-0.4.0
rootdir: /tmp/toto, inifile:
plugins: hypothesis-3.38.5
collected 1 items 

test_dummy.py .

========================================================================================================== 1 passed in 0.00 seconds ===========================================================================================================

Change detected: test_dummy.py

Running: py.test
============================================================================================================= test session starts =============================================================================================================
platform linux -- Python 3.6.3, pytest-3.0.7, py-1.5.2, pluggy-0.4.0
rootdir: /tmp/toto, inifile:
plugins: hypothesis-3.38.5
collected 0 items / 1 errors 

=================================================================================================================== ERRORS ====================================================================================================================
_______________________________________________________________________________________________________ ERROR collecting test_dummy.py ________________________________________________________________________________________________________
ImportError while importing test module '/tmp/toto/test_dummy.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test_dummy.py:1: in <module>
    import not_found
E   ModuleNotFoundError: No module named 'not_found'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================================================================================== 1 error in 0.12 seconds ===========================================================================================================
joeyespo commented 6 years ago

Just released v4.2.0 which includes a fix for this. Be sure to pip install --upgrade pytest-watch.

Thanks for opening the issue, @PhE!