MISP / PyMISP

Python library using the MISP Rest API
Other
445 stars 280 forks source link

nosetest is not working for checking installation #329

Closed ghost closed 5 years ago

ghost commented 5 years ago

I installed PyMISP using virtual environment and while running the test, nosetests-3.4 --with-coverage --cover-package=pymisp,tests --cover-tests tests/test_*.py

Output: "...................S.......................................... Name Stmts Miss Cover

pymisp/init.py 33 5 85% pymisp/abstract.py 182 37 80% pymisp/api.py 1414 815 42% pymisp/exceptions.py 36 0 100% pymisp/mispevent.py 686 158 77% pymisp/tools/init.py 18 1 94% pymisp/tools/abstractgenerator.py 43 32 26% pymisp/tools/asnobject.py 14 8 43% pymisp/tools/create_misp_object.py 74 57 23% pymisp/tools/domainipobject.py 14 8 43% pymisp/tools/elfobject.py 70 52 26% pymisp/tools/ext_lookups.py 31 19 39% pymisp/tools/fail2banobject.py 12 6 50% pymisp/tools/fileobject.py 62 36 42% pymisp/tools/genericgenerator.py 8 5 38% pymisp/tools/geolocationobject.py 14 8 43% pymisp/tools/load_warninglists.py 15 9 40% pymisp/tools/machoobject.py 67 49 27% pymisp/tools/neo4j.py 39 27 31% pymisp/tools/openioc.py 94 81 14% pymisp/tools/peobject.py 102 79 23% pymisp/tools/sbsignatureobject.py 11 7 36% pymisp/tools/stix.py 21 15 29% pymisp/tools/vtreportobject.py 46 33 28% tests/init.py 0 0 100% tests/test_mispevent.py 239 9 96% tests/test_offline.py 385 36 91%

TOTAL 3730 1592 57%

Ran 62 tests in 1.915s

OK (SKIP=1) "

While running the second test, "====================================================================== ERROR: Failure: ImportError (cannot import name 'ExpandedPyMISP')

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/nose/failure.py", line 39, in runTest raise self.exc_val.with_traceback(self.tb) File "/usr/local/lib/python3.5/dist-packages/nose/loader.py", line 418, in loadTestsFromName addr.filename, addr.module) File "/usr/local/lib/python3.5/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/local/lib/python3.5/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/usr/lib/python3.5/imp.py", line 234, in load_module return load_source(name, filename, file) File "/usr/lib/python3.5/imp.py", line 172, in load_source module = _load(spec) File "", line 693, in _load File "", line 673, in _load_unlocked File "", line 665, in exec_module File "", line 222, in _call_with_frames_removed File "/home/ankit/PyMISP/tests/testlive_comprehensive.py", line 6, in from pymisp import ExpandedPyMISP, MISPEvent, MISPOrganisation, MISPUser, Distribution, ThreatLevel, Analysis, MISPObject ImportError: cannot import name 'ExpandedPyMISP'

Name Stmts Miss Cover

pymisp/init.py 33 5 85% pymisp/abstract.py 182 37 80% pymisp/api.py 1414 815 42% pymisp/exceptions.py 36 0 100% pymisp/mispevent.py 686 158 77% pymisp/tools/init.py 18 1 94% pymisp/tools/abstractgenerator.py 43 32 26% pymisp/tools/asnobject.py 14 8 43% pymisp/tools/create_misp_object.py 74 57 23% pymisp/tools/domainipobject.py 14 8 43% pymisp/tools/elfobject.py 70 52 26% pymisp/tools/ext_lookups.py 31 19 39% pymisp/tools/fail2banobject.py 12 6 50% pymisp/tools/fileobject.py 62 36 42% pymisp/tools/genericgenerator.py 8 5 38% pymisp/tools/geolocationobject.py 14 8 43% pymisp/tools/load_warninglists.py 15 9 40% pymisp/tools/machoobject.py 67 49 27% pymisp/tools/neo4j.py 39 27 31% pymisp/tools/openioc.py 94 81 14% pymisp/tools/peobject.py 102 79 23% pymisp/tools/sbsignatureobject.py 11 7 36% pymisp/tools/stix.py 21 15 29% pymisp/tools/vtreportobject.py 46 33 28% tests/init.py 0 0 100%

TOTAL 3106 1547 50%

Ran 1 test in 0.001s

FAILED (errors=1) "

Please suggest any corrections to resolve the above code. Thanks

Rafiot commented 5 years ago

Yes, ExpandedPyMISP is only compatible with python 3.6+ and is used by testlive_comprehensive.py, which fails at import.

All the other tests should be passing fine.

asghar3166 commented 5 years ago

Is there a solution to this exception? Any recommendation on this fix would be appreciated.

ERROR: Failure: ImportError (cannot import name 'ExpandedPyMISP') ImportError: cannot import name "ExpandedPyMISP"

image

Rafiot commented 5 years ago

Yes: using python 3.6 ;)

ExpandedPyMISP, used by this test suite, is only compatible with python 3.6+

asghar3166 commented 5 years ago

Hi Rafiot,

Thank you for the quick response. I will try python 3.6...

knageswara78 commented 4 years ago

One approach is to use python 3.6 version like 3.6.5 is a stable version. Another approach is if you want to continue in python 3.5 version itself then python 3.5.2 it worked correctly.

Rafiot commented 4 years ago

Python 3.5 is not supported anymore by PyMISP (starting with 2.4.120).