splunk / addonfactory-solutions-library-python

SDK for Developing Solutions in Splunk Enterprise with Python
https://splunk.github.io/addonfactory-solutions-library-python/
Apache License 2.0
17 stars 7 forks source link

unit test of code importing solnlib errors on 'splunk' dependency #376

Closed pmeyerson closed 4 months ago

pmeyerson commented 4 months ago

It seems that a recent version of solnlib injected a new dependency on module 'splunk', which causes unit tests of my own code to error out. Is there some work around, or could the module which requires this dependency be moved to a separate module requiring explicit import? Or is there some work around I could apply to my own code?

ImportError while importing test module '/Users/pmeyerso/Documents/repos/testtools/tests/test_unit_dashboard_builder.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/init.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) tests/test_unit_my_custom_code.py:31: in import my_custom_code_class as lib output/app/bin/my_custom_code_class.py:18: in from my_helper_code import AppScript output/app/bin/my_helper_code.py:11: in import solnlib.log, solnlib.conf_manager, solnlib.utils output/app/lib/solnlib/init.py:19: in from . import ( output/app/lib/solnlib/server_info.py:23: in from splunk.rest import getWebCertFile, getWebKeyFile E ModuleNotFoundError: No module named 'splunk'

Thanks for any suggestions. Reverting to 4.14.1 as a workaround.

artemrys commented 4 months ago

@pmeyerson missed this issue, it is now fixed and released as v5.1.1