def main(): if os.path.exists('xunit_results'): shutil.rmtree('xunit_results') os.mkdir('xunit_results') numpy.test('full', extra_argv='--with-xunit --xunit-file=xunit_results/numpy_tests.xml'.split()) run(defaultTest='jasmin_scivm/tests', argv='dummy --with-xunit --xunit-file=xunit_results/jap_tests.xml'.split(), exit=False) run(defaultTest='cdat_lite', argv='dummy --with-xunit --xunit-file=xunit_results/cdat_tests.xml'.split(), exit=False)
def main(): if os.path.exists('xunit_results'): shutil.rmtree('xunit_results') os.mkdir('xunit_results') numpy.test( 'full', extra_argv='--with-xunit --xunit-file=xunit_results/numpy_tests.xml'. split()) run(defaultTest='jasmin_scivm/tests', argv='dummy --with-xunit --xunit-file=xunit_results/jap_tests.xml'. split(), exit=False) run(defaultTest='cdat_lite', argv='dummy --with-xunit --xunit-file=xunit_results/cdat_tests.xml'. split(), exit=False)
def run_tests(): if not hasattr(os, 'system'): # Running on iOS. Replace forbidden functions with test-skipping # stubs. replace_forbidden_funcs() # Run Python test suite from test.libregrtest.main import main try: main() except SystemExit: pass # Run NumPy test suite import numpy sys.path.append(os.path.join(sys.prefix, 'pytest')) with tempfile.TemporaryDirectory() as tmpdir: origdir = os.getcwd() os.chdir(tmpdir) try: numpy.test('full') finally: os.chdir(origdir)
from __future__ import print_function import sys from numpy import test from gpaw.mpi import rank _stdout = sys.stdout _stderr = sys.stderr # numpy tests write to stderr sys.stderr = open("numpy_test%02d.out" % rank, "w") result = test(verbose=10) sys.stdout = _stdout sys.stderr = _stderr if not result.wasSuccessful(): print("numpy_test%02d.out" % rank, result.errors, result.failures, file=sys.stderr) assert result.wasSuccessful()
"--mode", action="store", dest="mode", default="fast", help="'fast', 'full', or something that could be " "passed to pytest [default: %default]") (options, args) = parser.parse_args() import numpy # Check that NPY_RELAXED_STRIDES_CHECKING is active when set. # The same flags check is also used in the tests to switch behavior. if (os.environ.get('NPY_RELAXED_STRIDES_CHECKING', "1") != "0"): if not numpy.ones((10, 1), order='C').flags.f_contiguous: print('NPY_RELAXED_STRIDES_CHECKING set, but not active.') sys.exit(1) elif numpy.ones((10, 1), order='C').flags.f_contiguous: print('NPY_RELAXED_STRIDES_CHECKING not set, but active.') sys.exit(1) result = numpy.test(options.mode, verbose=options.verbose, extra_argv=args, doctests=options.doctests, coverage=options.coverage) if result: sys.exit(0) else: sys.exit(1)
action="store_true", dest="coverage", default=False, help="report coverage of NumPy code (requires 'coverage' module") parser.add_option("-m", "--mode", action="store", dest="mode", default="fast", help="'fast', 'full', or something that could be " "passed to nosetests -A [default: %default]") (options, args) = parser.parse_args() import numpy # Check that NPY_RELAXED_STRIDES_CHECKING is active when set. # The same flags check is also used in the tests to switch behavior. if (os.environ.get('NPY_RELAXED_STRIDES_CHECKING', "0") != "0"): if not numpy.ones((10,1), order='C').flags.f_contiguous: print('NPY_RELAXED_STRIDES_CHECKING set, but not active.') sys.exit(1) elif numpy.ones((10,1), order='C').flags.f_contiguous: print('NPY_RELAXED_STRIDES_CHECKING not set, but active.') sys.exit(1) result = numpy.test(options.mode, verbose=options.verbose, extra_argv=args, doctests=options.doctests, coverage=options.coverage) if result.wasSuccessful(): sys.exit(0) else: sys.exit(1)
import numpy as np np.test('full')
import numpy as np np.test()
import numpy.core.multiarray import numpy.core.numeric import numpy.core.umath import numpy.core.umath_tests import numpy.fft.pocketfft import numpy.linalg.lapack_lite import numpy.random.mtrand try: from numpy.fft import _restore_dict # sentinal that mkl_fft is in use from mkl_fft import __version__ print('USING MKLFFT: %s' % __version__) except ImportError: print("Not using MKLFFT") try: print('MKL: %r' % numpy.__mkl_version__) except AttributeError: print('NO MKL') if sys.platform == 'darwin': os.environ['LDFLAGS'] = ' '.join( (os.getenv('LDFLAGS', ''), " -undefined dynamic_lookup")) os.environ['CFLAGS'] = ' '.join((os.getenv('CFLAGS', ''), " -fno-lto")) elif sys.platform.startswith('linux'): os.environ['LDFLAGS'] = ' '.join((os.getenv('LDFLAGS', ''), '-shared')) os.environ['FFLAGS'] = ' '.join((os.getenv('FFLAGS', ''), '-Wl,-shared')) result = numpy.test() sys.exit(not result)
def test_numpy_off(initialize_pnumpy): if HAVE_PNUMPY: np.test()
import os import sys import numpy import numpy.core.multiarray import numpy.core.multiarray_tests import numpy.core.numeric import numpy.core.operand_flag_tests import numpy.core.struct_ufunc_test import numpy.core.test_rational import numpy.core.umath import numpy.core.umath_tests import numpy.fft.fftpack_lite import numpy.linalg.lapack_lite import numpy.random.mtrand sys.exit(not numpy.test().wasSuccessful())
import nose import numpy import scipy numpy.test('full') #scipy.test('full')
def test_resize_timeseries(self): np.test() ts = pd.DataFrame([i for i in range(10)]) self.assertEqual(ts.shape[0] * 4, self.mgen._resize_timeseries(ts, 1, 0.25).shape[0])
def test_numpy_on(initialize_pnumpy): pn.atop_enable() np.test()
def test_numpy_off(initialize_pnumpy): np.test()
def body(): import numpy numpy.test()
def run_numpy_tests(*args, **kwargs): import numpy numpy.show_config() numpy.test()
# Databricks notebook source # MAGIC %run ./InstallDepedencies # COMMAND ---------- import numpy print ( "***** Hello World ********") numpy.test ('full') print ("***** DUPA ***** ") print ("proba 2") print ("***** Hello World********") if len(fname) < 1 : fname = "mbox-short.txt" fh = open(fname) count = 0 lst=list() hours_full=list() hour=dict() if len(fname) < 1 : fname = "mbox-short.txt" fh = open(fname) count = 0 lst=list() hours_full=list() hour=dict() for line in fh: #print(line.rstrip()) if not line.startswith('From'): continue lst=line.rstrip().split()
def test_numpy_on(initialize_pnumpy): if HAVE_PNUMPY: pn.atop_enable() np.test()
def est_numpy_all(): "Run the entire numpy test suite" import numpy numpy.test()
# if platform.machine() != 'armv6l': # import numpy.core._dotblas import numpy.core.multiarray import numpy.core.multiarray_tests # import numpy.core.scalarmath import numpy.core.umath import numpy.core.umath_tests import numpy.fft.fftpack_lite # import numpy.lib._compiled_base import numpy.linalg.lapack_lite import numpy.random.mtrand # from numpy.fft import using_mklfft # sys.gettotalrefcount() if sys.platform == "win32" and sys.version_info[0] == 3: print("Not running numpy tests Windows on Py3k") else: numpy.test() try: print("MKL: %r" % numpy.__mkl_version__) except AttributeError: print("NO MKL") # print('USING MKLFFT: %s' % using_mklfft)
import numpy from proteus import Comm comm = Comm.init() if comm.isMaster(): numpy.test(verbose=2) print("PEXPECT_EXIT")
have_mkl = True except AttributeError: print('NO MKL') have_mkl = False print('USING MKLFFT: %s' % using_mklfft) if sys.platform == 'darwin': os.environ['LDFLAGS'] = ' '.join((os.getenv('LDFLAGS', ''), " -undefined dynamic_lookup")) elif sys.platform.startswith('linux'): del os.environ['LDFLAGS'] del os.environ['CFLAGS'] del os.environ['FFLAGS'] # We have a test-case failure on 32-bit platforms: # https://github.com/numpy/numpy/issues/9665 # -fsanitize=signed-integer-overflow gave nothing, # -fno-strict-aliasing didn't help either. # TODO :: Investigate this properly. if sys.maxsize > 2**32: sys.exit(not numpy.test().wasSuccessful()) # --- run_test.py (end) --- print('===== numpy-1.14.0-py36h3dfced4_1 OK ====='); print("import: 'numpy'") import numpy print("import: 'numpy.linalg.lapack_lite'") import numpy.linalg.lapack_lite
# Monkey patch numpy.loadtxt np.loadtxt = _loadtxt if __name__ == "__main__": descr = textwrap.dedent(""" Run numpy tests with loadtxt replaced by a wrapper of the new reader. Some useful tests to pass as the -t option: numpy.lib.tests.test_regression numpy.lib.tests.test_io::TestLoadTxt """) parser = argparse.ArgumentParser( description=descr, formatter_class=argparse.RawDescriptionHelpFormatter) test_help = ('Test to run, using the same syntax as the -t option ' 'of runtests.py.') parser.add_argument('-t', '--test', required=True, help=test_help) verbose_help = ('Verbosity value for test outputs, in the range 1-3. ' 'Default is 1.') parser.add_argument('-v', '--verbose', type=int, choices=[1, 2, 3], default=1, help=verbose_help) args = parser.parse_args() np.test(verbose=args.verbose, tests=[args.test])
def runNumpyTest(self): import numpy numpy.test()
import numpy as np import pandas as pd import sklearn as sl import scipy as sp import matplotlib.pyplot as pl np.test()
import numpy numpy.test(1,1)
print('HAS MKL: %r' % has_mkl) mkl_version = getattr(numpy, '__mkl_version__', None) print('MKL VERSION: %s' % mkl_version) assert has_mkl == bool(mkl_version) import numpy.core.multiarray import numpy.core.multiarray_tests import numpy.core.numeric import numpy.core.operand_flag_tests import numpy.core.struct_ufunc_test import numpy.core.test_rational import numpy.core.umath import numpy.core.umath_tests import numpy.fft.fftpack_lite import numpy.linalg._umath_linalg import numpy.linalg.lapack_lite import numpy.random.mtrand from cio_bt.mkl_link import test_modules test_modules([numpy.linalg.lapack_lite]) from numpy.fft import using_mklfft if sys.platform == 'win32' and sys.version_info[0] == 3: print('Not running numpy tests Windows on Py3k') else: numpy.test() print('USING MKLFFT: %s' % using_mklfft)
import os import sys import numpy import numpy.core.multiarray import numpy.core._multiarray_tests import numpy.core.numeric import numpy.core._operand_flag_tests import numpy.core._struct_ufunc_tests import numpy.core._rational_tests import numpy.core.umath import numpy.core._umath_tests import numpy.fft.fftpack_lite import numpy.linalg.lapack_lite import numpy.random.mtrand sys.exit(not numpy.test())