pydoit / doit

CLI task management & automation tool
http://pydoit.org
MIT License
1.87k stars 175 forks source link

0.32.0: failing tests due to broken imports and failing raises #342

Closed dvzrv closed 4 years ago

dvzrv commented 4 years ago

Describe the bug

During packaging of 0.32.0 I'm running into the following two issues during test:

============================= test session starts ==============================           
platform linux -- Python 3.8.0, pytest-5.3.1, py-1.8.0, pluggy-0.13.1  
rootdir: /build/python-doit/src/python-doit-0.32.0                                         
collected 774 items                                           

tests/test___init__.py .                                                 [  0%]
tests/test___main__.py F                                                 [  0%]
tests/test_action.py ................................................... [  6%]                                                                                                       
.............................................                            [ 12%]
tests/test_api.py .                                                      [ 12%]            
tests/test_cmd_auto.py ......                                            [ 13%]                                                                                                       
tests/test_cmd_base.py ............................                      [ 17%]                                                                                                                                                                                                                                                                                             
tests/test_cmd_clean.py ...........                                      [ 18%]                                                                                                                                                                                                                                                                                             
tests/test_cmd_completion.py ..........                                  [ 19%]      
tests/test_cmd_dumpdb.py .                                               [ 20%]                                                                                                       
tests/test_cmd_forget.py ......                                          [ 20%]                                                                                                       
tests/test_cmd_help.py ........                                          [ 21%]            
tests/test_cmd_ignore.py .....                                           [ 22%]          
tests/test_cmd_info.py ......                                            [ 23%]                                                                                                       
tests/test_cmd_list.py .................                                 [ 25%]        
tests/test_cmd_resetdep.py .........                                     [ 26%]                                                                                                       
tests/test_cmd_run.py .............                                      [ 28%]          
tests/test_cmd_strace.py ssssss                                          [ 29%] 
tests/test_cmdparse.py .......................................           [ 34%]
tests/test_control.py .................................................. [ 40%]
..........                                                               [ 41%]
tests/test_dependency.py ...............s.s............................. [ 47%]          
........................................................................ [ 57%]                                                                                                                                                                                                                                                                                             
......................................                                   [ 62%]
tests/test_doit_cmd.py ..................                                [ 64%]
tests/test_exceptions.py .........                                       [ 65%]
tests/test_filewatch.py ....                                             [ 66%]
tests/test_loader.py ..........................................          [ 71%]
tests/test_plugin.py .........                                           [ 72%]
tests/test_reporter.py ............................                      [ 76%] 
tests/test_runner.py ................................................... [ 82%]            
.........F..............                                                 [ 86%]
tests/test_task.py ..................................................... [ 92%]            
...........................                                              [ 96%]
tests/test_tools.py ............................                         [100%]

=================================== FAILURES ===================================
_________________________________ test_execute _________________________________

depfile_name = '/tmp/pytest-of-builduser/pytest-0/test_execute0/testdb'

    def test_execute(depfile_name):                           
>       assert 0 == subprocess.call([executable, '-m', 'doit', 'list',                     
                                     '--db-file', depfile_name])               
E       AssertionError: assert 0 == 3                                          
E        +  where 3 = <function call at 0x65964a66c8b0>(['/usr/bin/python', '-m', 'doit', 'list', '--db-file', '/tmp/pytest-of-builduser/pytest-0/test_execute0/testdb'])             
E        +    where <function call at 0x65964a66c8b0> = subprocess.call        

tests/test___main__.py:6: AssertionError                                                                                                                                              
----------------------------- Captured stderr call -----------------------------                                                                                                                                                                                                                                                                                            
Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                          
  File "/build/python-doit/src/python-doit-0.32.0/doit/doit_cmd.py", line 190, in run
    return command.parse_execute(args)                                                                                                                                                
  File "/build/python-doit/src/python-doit-0.32.0/doit/cmd_base.py", line 150, in parse_execute                                                                                       
    return self.execute(params, args)                                                      
  File "/build/python-doit/src/python-doit-0.32.0/doit/cmd_base.py", line 554, in execute
    self.loader.setup(params)                                                                                                                                                         
  File "/build/python-doit/src/python-doit-0.32.0/doit/cmd_base.py", line 417, in setup
    self.namespace = dict(inspect.getmembers(loader.get_module(                                                                                                                       
  File "/build/python-doit/src/python-doit-0.32.0/doit/loader.py", line 95, in get_module
    return importlib.import_module(os.path.splitext(file_name)[0])              
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module  
    return _bootstrap._gcd_import(name[level:], package, level)                
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import              
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load                      
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked                                                                                                                                                                                                                                                                                                
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked            
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module      
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed 
  File "/build/python-doit/src/python-doit-0.32.0/dodo.py", line 7, in <module>
    from doitpy.pyflakes import Pyflakes                                       
ModuleNotFoundError: No module named 'doitpy'                                  
______________ TestJobTask.test_not_picklable_raises_InvalidTask _______________

self = <tests.test_runner.TestJobTask object at 0x659648fb7820>                

    @pytest.mark.xfail('PLAT_IMPL == "PyPy"')  # pypy can handle it :)         
    def test_not_picklable_raises_InvalidTask(self):                           
        # create a large enough recursive obj so pickle fails                              
        d1 = {}                                                                 
        last = d1                                                               
        for x in range(400):                                                               
            dn = {'p': last}                                           
            last = dn                                                                      
        d1['p'] = last                                        

        def non_top_function(): pass                                           
        t1 = Task('t1', [non_top_function, (d1,)])                             
>       pytest.raises(InvalidTask, runner.JobTask, t1)                                                                                                                                
E       Failed: DID NOT RAISE <class 'doit.exceptions.InvalidTask'>            

tests/test_runner.py:592: Failed                                                                                                                                                      
=============================== warnings summary ===============================                                                                                                                                                                                                                                                                                            
tests/test_filewatch.py::TestFileWatcher::testLoop                                                                                                                                                                                                                                                                                                                          
tests/test_filewatch.py::TestFileWatcher::testLoop                                   
  /build/python-doit/src/python-doit-0.32.0/tests/test_filewatch.py:74: DeprecationWarning: isAlive() is deprecated, use is_alive() instead                                           
    assert loop_thread.isAlive()                                                                                                                                                      

tests/test_filewatch.py::TestFileWatcher::testLoop                                       
  /build/python-doit/src/python-doit-0.32.0/tests/test_filewatch.py:96: DeprecationWarning: isAlive() is deprecated, use is_alive() instead                                           
    if loop_thread.isAlive(): # pragma: no cover                                       

-- Docs: https://docs.pytest.org/en/latest/warnings.html                                 
============= 2 failed, 764 passed, 8 skipped, 3 warnings in 8.53s =============

This happens after running:

python setup.py build
export PYTHONPATH="${PWD}/build/lib:${PYTHONPATH}"
py.test

The latter of the two failing tests is also covered in #341. Is it safe to ignore these two?

Environment

  1. OS: Arch Linux
  2. python version: python3.8
  3. doit version: 0.32.0
schettino72 commented 4 years ago

Apart from #341 Please check https://github.com/pydoit/doit#development-setup (you need to install dependencies)