Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(20)  |  Call(16)  |  Derive(0)  |  Import(4)

        def run_cli(*args):
    p = Process('python', '-m', 'sbgsdk.cli', *args)
    p.run()
    return p
        


src/s/b/sbgsdk-0.5.4/sbgsdk/tests/cli_test/execute_parallel/test_execute_parallel.py   sbgsdk(Download)
import os
import json
 
from sbgsdk.tests.common import run_cli, cleanup, RED_ADDER_ID
 
def test_execute_parallel():
    run_cli('run', '-i', 'input_parallel.json', '-o', 'output_parallel.json')
    s = json.load(open('output_parallel.json'))
    assert s['wrapper_id'] == RED_ADDER_ID
    assert s['$$type'] == 'job'
def test_execute_split():
    run_cli('run', '-i', 'input_split.json', '-o', 'output_split.json')
    s = json.load(open('output_split.json'))
    assert s['$$type'] == 'job'
    assert s['args']['$method'] == 'unsplit'
def test_execute_add():
    run_cli('run', '-i', 'input_add.json', '-o', 'output_add.json')
    s = json.load(open('output_add.json'))
    assert isinstance(s, basestring) and s.endswith('.txt'), 'Unexpected output: %s' % s
 
 
@cleanup
def test_execute_unsplit():
    run_cli('run', '-i', 'input_unsplit.json', '-o', 'output_unsplit.json')

src/s/b/sbgsdk-0.5.4/sbgsdk/tests/cli_test/test.py   sbgsdk(Download)
import os
import json
import unittest
from sbgsdk.tests.common import run_cli, remove_temp_files
 
    def test_schema(self):
        p = run_cli('schema')
        s = json.loads(p.stdout.get_string())
        self.assertIsInstance(s, list)
        if s:
            self.assertIn('wrapper_id', s[0])
 
    def test_run_full(self):
        run_cli('run-full', '-i', 'input_full.json')
    def test_execute_error(self):
        run_cli('run', '-i', 'input_error.json', '-o', 'output_error.json')
        s = json.load(open('output_error.json'))
        self.assertEqual(s['$$type'], 'error')
        self.assertIn('No such file', s['message'])

src/s/b/sbgsdk-0.5.4/sbgsdk/tests/cli_test/execute_single/test_execute_single.py   sbgsdk(Download)
from sbgsdk import errors
from sbgsdk.process import process_fails
from sbgsdk.tests.common import run_cli, cleanup
 
 
def test_execute_no_such_method():
    run_cli('run', '-i', 'input_no_such_method.json')
 
 
@cleanup
@process_fails(exit_code=errors.NO_RESOURCES_ERROR)
def test_execute_no_resources():
    run_cli('run', '-i', 'input_execute_no_resources.json')
def test_execute_single():
    run_cli('run', '-i', 'input_single.json', '-o', 'output_single.json')
    s = json.load(open('output_single.json'))
    assert s['c'].endswith('/output_single.txt'), 'Unexpected output c: %s' % s['c']
    assert os.path.isfile(s['c'])

src/s/b/sbgsdk-0.5.4/sbgsdk/tests/cli_test/job_submit/test_job_submit.py   sbgsdk(Download)
from sbgsdk import errors
from sbgsdk.process import process_fails
from sbgsdk.tests.common import run_cli, cleanup, RED_ADDER_ID
 
 
def test_run_not_a_job():
    run_cli('run', '-i', 'input_not_a_job.json')
 
 
@cleanup
@process_fails(exit_code=errors.NO_WRAPPER_ID_ERROR)
def test_run_no_wrapper_id():
    run_cli('run', '-i', 'input_no_wrapper_id.json')
def test_run_no_resources():
    run_cli('run', '-i', 'input_no_resources.json')
    s = json.load(open('__out__.json'))
    assert s['wrapper_id'] == RED_ADDER_ID
    assert s['$$type'] == 'job'
def test_run_required_input_missing():
    run_cli('run', '-i', 'input_required_input_missing.json')
 
 
@cleanup