Skip to content

Commit

Permalink
rm duplicates tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giannisdoukas committed Jul 14, 2020
1 parent f49449b commit 3c6221d
Showing 1 changed file with 0 additions and 112 deletions.
112 changes: 0 additions & 112 deletions tests/test_CWLKernel_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,52 +118,6 @@ def test_display_data_magic_command(self):
responses[-1][0][2]['text']
)

def test_display_data_magic_command(self):
from cwlkernel.CWLKernel import CWLKernel
kernel = CWLKernel()
# monitor responses
responses = []
kernel.send_response = lambda *args, **kwargs: responses.append((args, kwargs))

with open(os.sep.join([self.cwl_directory, 'echo_stdout.cwl'])) as f:
workflow_str = f.read()
self.assertDictEqual(
{'status': 'ok', 'execution_count': 0, 'payload': [], 'user_expressions': {}},
kernel.do_execute(workflow_str, False)
)

with open(os.sep.join([self.data_directory, 'echo-job.yml'])) as f:
data = f"% execute echo\n{f.read()}"
self.assertDictEqual(
{'status': 'ok', 'execution_count': 0, 'payload': [], 'user_expressions': {}},
kernel.do_execute(data, False)
)

kernel.do_execute('% displayData')
self.assertEqual(
'ERROR: you must select an output to display. Correct format:\n % displayData [output name]',
responses[-1][0][2]['text']
)

kernel.do_execute('% displayData echo_output')
self.assertEqual(
'Hello world!\n',
responses[-1][0][2]['text']
)

self.assertDictEqual(
{'status': 'ok', 'execution_count': 0, 'payload': [], 'user_expressions': {}},
kernel.do_execute(data, False)
)
self.assertEqual(
{'status': 'ok', 'execution_count': 0, 'payload': [], 'user_expressions': {}},
kernel.do_execute('% displayData echo_output')
)
self.assertEqual(
'Hello world!\n',
responses[-1][0][2]['text']
)

def test_logs_magic_command(self):
from cwlkernel.CWLKernel import CWLKernel
kernel = CWLKernel()
Expand Down Expand Up @@ -365,72 +319,6 @@ def test_compose(self):
location: {os.path.join(self.data_directory, "data.csv")}""")
)

def test_compose(self):
kernel = CWLKernel()
# cancel send_response
responses = []
kernel.send_response = lambda *args, **kwargs: responses.append((args, kwargs))
with open(os.sep.join([self.cwl_directory, 'head.cwl'])) as f:
head = f.read()
with open(os.sep.join([self.cwl_directory, 'tail.cwl'])) as f:
tail = f.read()
self.assertDictEqual(
{'status': 'ok', 'execution_count': 0, 'payload': [], 'user_expressions': {}},
kernel.do_execute(head)
)
self.assertDictEqual(
{'status': 'ok', 'execution_count': 0, 'payload': [], 'user_expressions': {}},
kernel.do_execute(tail)
)

self.assertDictEqual(
{'status': 'ok', 'execution_count': 0, 'payload': [], 'user_expressions': {}},
kernel.do_execute("""% newWorkflow main
% newWorkflowAddStep tail tailstepid
% newWorkflowAddStep head headstepid
% newWorkflowAddInput headstepid headinput
id: inputfile
type: File
% newWorkflowAddStepIn tailstepid headstepid headoutput
tailinput: headstepid/headoutput
% newWorkflowAddOutputSource tailstepid/tailoutput File
% newWorkflowBuild""")
)

self.assertDictEqual(
{
"cwlVersion": "v1.0",
"class": "Workflow",
"id": "main",
"inputs": [{'id': 'inputfile', 'type': 'File'}],
"outputs": [{'id': 'tailoutput', 'type': 'File', 'outputSource': "tailstepid/tailoutput"}],
"steps": {
"headstepid":
{
"run": "head.cwl",
"in": {"headinput": "inputfile"},
"out": ['headoutput']
},
"tailstepid":
{
"run": "tail.cwl",
"in": {"tailinput": "headstepid/headoutput"},
"out": ['tailoutput']
},
},
'requirements': {}
},
yaml.load(kernel._workflow_repository.get_by_id("main").to_yaml(), yaml.Loader),
)

self.assertDictEqual(
{'status': 'ok', 'execution_count': 0, 'payload': [], 'user_expressions': {}},
kernel.do_execute(f"""% execute main
inputfile:
class: File
location: {os.path.join(self.data_directory, "data.csv")}""")
)

def test_githubImport(self):
when(requests) \
.get("https://api.github.com/repos/giannisdoukas/CWLJNIKernel/contents/tests/cwl/head.cwl?ref=dev") \
Expand Down

0 comments on commit 3c6221d

Please sign in to comment.