コード例 #1
0
 def test_append(self):
     flist = list(zip(map(str, range(10)), map(str, range(10, 20))))
     cases = [testcase.TestCase(a, b) for a, b in flist]
     caselist = testcase.TestCaseList()
     for a, b in flist:
         caselist.add_case(a, b)
     self.assertEqual(caselist, testcase.TestCaseList(cases))
コード例 #2
0
def run():
    '''Run test case.

    Parameters
    ----------
    None

    Returns
    -------
    None

    '''

    # SETUP TEST CASE
    # ---------------
    # Set URL for testcase
    tc = testcase.TestCase()
    # ---------------

    # GET TEST INFORMATION
    # --------------------
    print('\nTEST CASE INFORMATION\n---------------------')
    # Test case name
    name = tc.get_name()
    print('Name:\t\t\t\t{0}'.format(name))
    # Inputs available
    inputs = tc.get_inputs()
    print('Control Inputs:\t\t\t{0}'.format(inputs))
    # Measurements available
    measurements = tc.get_measurements()
    print('Measurements:\t\t\t{0}'.format(measurements))
    # Default simulation step
    step_def = tc.get_step()
    print('Default Simulation Step:\t{0}'.format(step_def))
    # --------------------

    # RUN TEST CASE
    # -------------
    # Reset test case
    print('Resetting test case if needed.')
    tc.reset()
    print('\nRunning test case...')

    # Simulation Loop
    start = time.time()
    for i in range(5000):
        # Advance simulation
        y = tc.advance({})
    end = time.time()
    print('\nBenchmark complete in {0} seconds.'.format(end - start))
コード例 #3
0
 def addTestCase(self, path):
     self._testcases.append(testcase.TestCase(path))
コード例 #4
0
ファイル: suite.py プロジェクト: tcmichael/python-sdk
#!/usr/bin/env python

import testcase

tc = testcase.TestCase()
if not tc.SetUp():
    exit(1)
success = 0
failed = 0
for k in testcase.TestCase.__dict__.keys():
    if k.startswith('Test'):
        print k
        ret = getattr(tc, k)()
        if 0 == ret:
            print "Success"
            success = success + 1
        else:
            print "Failed"
            failed = failed + 1

print '%d Success' % success
print '%d Failed' % failed

if failed != 0:
    exit(1)
else:
    exit(0)
コード例 #5
0
    downloadpath = os.path.join(directory, upload_file_name)

    if not os.path.exists(directory):
        os.makedirs(directory)

    bucket = s3.Bucket('alfalfa')
    bucket.download_file(key, downloadpath)

    sims.update_one({"_id": upload_id}, {"$set": {
        "simStatus": "Running"
    }}, False)

    # Load fmu
    config = {'fmupath': downloadpath, 'step': 60}

    tc = testcase.TestCase(config)

    u = {}
    while tc.start_time < 10000:
        tc.advance(u)

    #shutil.rmtree(directory)

    time = str(datetime.now(tz=pytz.UTC))
    sims.update_one({"_id": upload_id}, {
        "$set": {
            "simStatus": "Complete",
            "timeCompleted": time,
            "s3Key": ''
        }
    }, False)