Menu

Can't run the misra.py unit test code

2019-07-11
2019-07-12
  • Richard Smith

    Richard Smith - 2019-07-11

    I"m getting the following error running the misra.py test code. Using HEAD.

    ________ ERROR at setup of test_loadRuleTexts_structure _________

    @pytest.fixture
    def checker():
    
      from addons.misra import MisraChecker, MisraSettings, get_args
    

    addons/test/test-misra.py:59:


    from __future__ import print_function
    

    import cppcheckdata
    E ModuleNotFoundError: No module named 'cppcheckdata'

    addons/misra.py:18: ModuleNotFoundError


     
  • Daniel Marjamäki

    I am not sure how you should run it. It does not seem that it's run by travis.

     
  • Daniel Marjamäki

    It seems to work for me:

    ~/cppcheck$ python -m pytest addons/test/test-misra.py
    ==================================================================================== test session starts =====================================================================================
    platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
    rootdir: /home/danielm/cppcheck, inifile:
    collected 7 items

    addons/test/test-misra.py .......

    ================================================================================== 7 passed in 0.82 seconds ==================================================================================

     
  • versat

    versat - 2019-07-12

    @Richard Are you using Python 3? I have observed the same when using Python 3, it is more "strict" (or whatever it should be called) when it comes to finding modules. Does it work using Python 2 for you?

     
  • Richard Smith

    Richard Smith - 2019-07-12

    You beat me to it. Yes that is the problem. I was using python3. If I use python2 it works.

    It it supposed to work with python3?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.