Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kb-sdk v1.2: python tests fail #347

Closed
ialarmedalien opened this issue Mar 20, 2020 · 2 comments
Closed

kb-sdk v1.2: python tests fail #347

ialarmedalien opened this issue Mar 20, 2020 · 2 comments

Comments

@ialarmedalien
Copy link
Collaborator

ialarmedalien commented Mar 20, 2020

Currently the Docker kbase/sdkbase2:python base image has v1.1 of kb-sdk installed on it. If you try to update kb-sdk to v1.2, running kb-sdk test fails as follows:

Running /home/runner/work/kb_sdk/kb_sdk/MyContigFilter/test_local/run_docker.sh with args run -v /home/runner/work/kb_sdk/kb_sdk/MyContigFilter/test_local/workdir:/kb/module/work -e SDK_CALLBACK_URL=http://172.17.0.1:38903 -e KB_SDK_TEST=1 test/mycontigfilter:latest test

Run Tests
if [ ! -f /kb/module/work/token ]; then echo -e '\nOutside a docker container please run "kb-sdk test" rather than "make test"\n' && exit 1; fi
bash test/run_tests.sh
Running test/run_tests.sh with args 
Removing temp files...
Finished removing temp files.
E
======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'MyContigFilter.authclient')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/miniconda/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/miniconda/lib/python3.6/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/miniconda/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/miniconda/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/miniconda/lib/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/miniconda/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/kb/module/test/MyContigFilter_server_test.py", line 8, in <module>
    from MyContigFilter.MyContigFilterServer import MethodContext
  File "/kb/module/lib/MyContigFilter/MyContigFilterServer.py", line 20, in <module>
    from MyContigFilter.authclient import KBaseAuth as _KBaseAuth
ModuleNotFoundError: No module named 'MyContigFilter.authclient'

Name                                   Stmts   Miss  Cover
----------------------------------------------------------
MyContigFilter/MyContigFilterImpl.py      61     48    21%
MyContigFilter/__init__.py                 0      0   100%
----------------------------------------------------------
Ran 1 test in 0.291s

FAILED (errors=1)
make: *** [test] Error 1
Makefile:67: recipe for target 'test' failed

No further investigation was done. Due to the way that kb-sdk is called in the kb-sdk test command, it's likely that this has been broken for quite a while. It looks from the error logs as though the location of the authclient and baseclient modules changed, but kb-sdk did not keep up with those changes.

@ialarmedalien
Copy link
Collaborator Author

ialarmedalien commented Jun 15, 2020

fix: in src/java/us/kbase/templates/module_test_python_client.vm.properties

@@ -6,7 +6,11 @@ from configparser import ConfigParser
 
 from ${module_name}.${module_name}Impl import ${module_name}
 from ${module_name}.${module_name}Server import MethodContext
-from ${module_name}.authclient import KBaseAuth as _KBaseAuth
+
+try:
+    from ${module_name}.authclient import KBaseAuth as _KBaseAuth
+except ImportError:
+    from installed_clients.authclient import KBaseAuth as _KBaseAuth

or just move the files to the appropriate dir.

@ialarmedalien
Copy link
Collaborator Author

Fixed by #367

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant