pytest.mark.test3 - python examples

Here are the examples of the python api pytest.mark.test3 taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 View Complete Implementation : test_mandelbrot.py
Copyright Apache License 2.0
Author : flatironinstitute
@pytest.mark.test3
@pytest.mark.errors
def test_mandelbrot_errors():
    from mountaintools import client as mt
    import mlprocessors as mlpr
    from .mandelbrot import ComputeMandelbrotWithError, combine_subsampled_mandelbrot
    import numpy as np

    num_iter = 10
    num_x = 50
    num_parallel = 1
    subsampling_factor = num_parallel

    job_args = [
        dict(
            num_x=num_x,
            num_iter=num_iter,
            subsampling_factor=subsampling_factor,
            subsampling_offset=offset,
            output_npy=dict(ext='.npy', upload=True),
            throw_error=(offset == 0),
            _force_run=False
            # _container='sha1://87319c2856f312ccc3187927ae899d1d67b066f9/03-20-2019/mountaintools_basic.simg'
        )
        for offset in range(subsampling_factor)
    ]

    jobs = ComputeMandelbrotWithError.createJobs(job_args)

    results = []
    for job in jobs:
        results.append(job.execute())

    X_list = []
    for result0 in results:
        if result0.retcode == 0:
            X0 = np.load(mt.realizeFile(result0.outputs['output_npy']))
            X_list.append(X0)
        else:
            print('Warning: retcode is non-zero for job.')
            print('============================================= BEGIN CONSOLE OUT ==========================================')
            print(mt.realizeFile(result0.console_out))
            print('============================================= END CONSOLE OUT ==========================================')

    if len(X_list) > 0:
        _ = combine_subsampled_mandelbrot(X_list)