This is an automated email from the ASF dual-hosted git repository.
csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-runtime-python.git
The following commit(s) were added to refs/heads/master by this push:
new 993c2ea disabled warnings at import for compatibility with old runtime (#46)
993c2ea is described below
commit 993c2ea77a2ecfd2fc247140cd442926c3e98500
Author: Michele Sciabarra <30654959+sciabarracom@users.noreply.github.com>
AuthorDate: Wed Jan 30 20:16:52 2019 +0100
disabled warnings at import for compatibility with old runtime (#46)
---
core/pythonActionLoop/pythonbuild.py.launcher.py | 4 +++-
.../scala/runtime/actionContainers/PythonActionContainerTests.scala | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/core/pythonActionLoop/pythonbuild.py.launcher.py b/core/pythonActionLoop/pythonbuild.py.launcher.py
index b7007c9..360cb55 100755
--- a/core/pythonActionLoop/pythonbuild.py.launcher.py
+++ b/core/pythonActionLoop/pythonbuild.py.launcher.py
@@ -19,7 +19,7 @@ from sys import stdin
from sys import stdout
from sys import stderr
from os import fdopen
-import sys, os, json, traceback
+import sys, os, json, traceback, warnings
try:
# if the directory 'virtualenv' is extracted out of a zip file
@@ -39,7 +39,9 @@ except Exception:
sys.exit(1)
# now import the action as process input/output
+warnings.filterwarnings("ignore")
from main__ import main as main
+warnings.resetwarnings()
# if there are some arguments exit immediately
if len(sys.argv) >1:
diff --git a/tests/src/test/scala/runtime/actionContainers/PythonActionContainerTests.scala
b/tests/src/test/scala/runtime/actionContainers/PythonActionContainerTests.scala
index edc376c..89d2426 100644
--- a/tests/src/test/scala/runtime/actionContainers/PythonActionContainerTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/PythonActionContainerTests.scala
@@ -157,8 +157,8 @@ class PythonActionContainerTests extends BasicActionRunnerTests with WskActorSys
Seq("__main__.py") ->
"""
|def main(args):
- | f = open('workfile', 'r')
- | return {'file': f.read()}
+ | with open('workfile', 'r') as f:
+ | return { 'file': f.read() }
""".stripMargin,
Seq("workfile") -> "this is a test string")
|