Skip to content

Commit c276ea2

Browse files
author
CI
committed
added proper testing capability for CI
1 parent a85df1f commit c276ea2

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ jobs:
1919
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
2020
- name: continous integration
2121
run : |
22-
python tests/test_adk_local.py
23-
python tests/test_adk_remote.py
22+
python run_tests.py
2423
- name: prepare
2524
run: |
2625
python -m pip install --upgrade pip

run_tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from tests.test_adk_remote import RemoteTest
2+
from tests.test_adk_local import LocalTest
3+
import unittest
4+
5+
if __name__ == "__main__":
6+
unittest.main()

tests/test_adk_local.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import sys
21
import json
32
import os
43
import unittest
54
from adk import ADK
6-
from adk_algorithms import *
5+
from tests.adk_algorithms import *
76

87

98
class LocalTest(unittest.TestCase):
109
fifo_pipe_path = "/tmp/algoout"
10+
1111
def setUp(self):
1212
try:
1313
os.remove(self.fifo_pipe_path)
@@ -26,7 +26,6 @@ def execute_without_load(self, input, apply):
2626
algo.init(input, pprint=lambda x: output.append(x))
2727
return output[0]
2828

29-
3029
def test_basic(self):
3130
input = 'Algorithmia'
3231
expected_output = {"metadata":
@@ -49,7 +48,6 @@ def test_basic_2(self):
4948
actual_output = json.loads(self.execute_without_load(input, apply_basic))
5049
self.assertEqual(expected_output, actual_output)
5150

52-
5351
def test_algorithm_loading_basic(self):
5452
input = "ignore me"
5553
expected_output = {'metadata':
@@ -89,5 +87,6 @@ def test_error_loading(self):
8987
actual_output["error"]["stacktrace"] = ''
9088
self.assertEqual(expected_output, actual_output)
9189

92-
if __name__ == '__main__':
93-
unittest.main()
90+
91+
def run_test():
92+
unittest.main()

tests/test_adk_remote.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import unittest
44
import os
55
from adk import ADK
6-
from adk_algorithms import *
6+
from tests.adk_algorithms import *
77

88

99
class RemoteTest(unittest.TestCase):
@@ -98,7 +98,8 @@ def test_algorithm_loading_basic(self):
9898
{
9999
'content_type': 'json'
100100
},
101-
'result': {'message': 'This message was loaded prior to runtime'}
101+
# 'result': {'message': 'This message was loaded prior to runtime'}
102+
'result': {'message': 'Not true'}
102103
}
103104
input = [str(json.dumps(input))]
104105
actual_output = self.execute_example(input, apply_input_or_context, loading_text)
@@ -135,5 +136,5 @@ def test_error_loading(self):
135136
self.assertEqual(expected_output, actual_output)
136137

137138

138-
if __name__ == '__main__':
139+
def run_test():
139140
unittest.main()

0 commit comments

Comments
 (0)