''' Run all the standalone tests using pytest. Exits with error code 1 if a test failed. ''' import sys import angela2 if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == 'no-parallel': if not angela2.test( [], test_codegen_independent=False, test_standalone='cpp_standalone', test_in_parallel=[] ): # If the test fails, exit with a non-zero error code sys.exit(1) else: if not angela2.test( [], test_codegen_independent=False, test_standalone='cpp_standalone' ): # If the test fails, exit with a non-zero error code sys.exit(1)
''' Run all the Cython tests (including tests that take a long time) using pytest. Exits with error code 1 if a test failed. ''' import sys import angela2 if not angela2.test( 'cython', long_tests=True): # If the test fails, exit with a non-zero error code sys.exit(1)
if operating_system in ['linux', 'windows']: openmp = True else: openmp = False reset_preferences = not cross_compiled if dtype_32_bit: float_dtype = np.float32 else: float_dtype = None if standalone: result = angela2.test([], test_codegen_independent=False, test_standalone='cpp_standalone', test_openmp=openmp, test_in_parallel=in_parallel, reset_preferences=reset_preferences, float_dtype=float_dtype, test_GSL=True) else: result = angela2.test(targets, test_codegen_independent=independent, test_standalone=None, test_in_parallel=in_parallel, reset_preferences=reset_preferences, float_dtype=float_dtype, test_GSL=True) if not result: sys.exit(1)
import sys import angela2 import numpy as np # Run tests for float32 and float64 success = [ angela2.test(long_tests=True, test_standalone='cpp_standalone', float_dtype=np.float32), angela2.test(long_tests=True, test_standalone='cpp_standalone', float_dtype=np.float64) ] result = [ 'Tests for {} dtype: {}'.format(dtype, 'passed' if status else 'FAILED') for status, dtype in zip(success, ['float32', 'float64']) ] print('\t--\t'.join(result)) if all(success): print('OK: All tests passed successfully') else: print('FAILED: Not all tests passed successfully (see above)') sys.exit(1)
''' Run all the Cython tests using pytest. Exits with error code 1 if a test failed. ''' import sys import angela2 if not angela2.test( 'cython'): # If the test fails, exit with a non-zero error code sys.exit(1)
''' Run all the numpy tests using pytest. Exits with error code 1 if a test failed. ''' import sys import angela2 if not angela2.test('numpy', test_codegen_independent=False ): # If the test fails, exit with a non-zero error code sys.exit(1)