This is an automated email from the ASF dual-hosted git repository.

baunsgaard pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/master by this push:
     new 8970977  [SYSTEMDS-3008] Python Tests Printing Fail Fix
8970977 is described below

commit 8970977d0349f26ca81150e52dd9e3a70ea4d3be
Author: baunsgaard <[email protected]>
AuthorDate: Thu Jun 3 15:56:56 2021 +0200

    [SYSTEMDS-3008] Python Tests Printing Fail Fix
    
    We have some unstable tests in the python api where the std out from
    systemds is captured in subsequent tests, rather than the tests intended.
    To fix this we simply add a small wait before probing the std out.
---
 src/main/python/tests/script/__init__.py             | 20 ++++++++++++++++++++
 .../python/tests/{ => script}/test_dml_script.py     |  8 ++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/main/python/tests/script/__init__.py 
b/src/main/python/tests/script/__init__.py
new file mode 100644
index 0000000..e66abb4
--- /dev/null
+++ b/src/main/python/tests/script/__init__.py
@@ -0,0 +1,20 @@
+# -------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# -------------------------------------------------------------
diff --git a/src/main/python/tests/test_dml_script.py 
b/src/main/python/tests/script/test_dml_script.py
similarity index 94%
rename from src/main/python/tests/test_dml_script.py
rename to src/main/python/tests/script/test_dml_script.py
index eb68257..f674057 100644
--- a/src/main/python/tests/test_dml_script.py
+++ b/src/main/python/tests/script/test_dml_script.py
@@ -20,6 +20,7 @@
 # -------------------------------------------------------------
 
 import unittest
+import time
 
 from systemds.context import SystemDSContext
 from systemds.script_building import DMLScript
@@ -43,6 +44,7 @@ class Test_DMLScript(unittest.TestCase):
         script = DMLScript(self.sds)
         script.add_code('print("Hello")')
         script.execute()
+        time.sleep(0.5)
         stdout = self.sds.get_stdout(100)
         self.assertListEqual(["Hello"], stdout)
 
@@ -52,6 +54,7 @@ class Test_DMLScript(unittest.TestCase):
         script.add_code('print("World")')
         script.add_code('print("!")')
         script.execute()
+        time.sleep(0.5)
         stdout = self.sds.get_stdout(100)
         self.assertListEqual(['Hello', 'World', '!'], stdout)
 
@@ -59,14 +62,11 @@ class Test_DMLScript(unittest.TestCase):
         scr_a = DMLScript(self.sds)
         scr_a.add_code('x = 4')
         scr_a.add_code('print(x)')
-        # TODO FIX HERE TO ENABLE MULTI EXECUTION
-        # scr_a.execute()
         scr_a.add_code('y = x + 1')
         scr_a.add_code('print(y)')
-        # print(scr_a.dml_script)
         scr_a.execute()
+        time.sleep(0.5)
         stdout = self.sds.get_stdout(100)
-        # print(stdout)
         self.assertEqual("4", stdout[0])
         self.assertEqual("5", stdout[1])
 

Reply via email to