
from constructors import array, open
from datashape import dshape


from constructors import array, open
from datashape import dshape

def test(verbosity=1, xunitfile=None, exit=False):
    """
    Runs the full Blaze test suite, outputting
    the results of the tests to sys.stdout.

    This uses nose tests to discover which tests to
    run, and runs tests in any 'tests' subdirectory
    within the Blaze module.

    Parameters
    ----------
        Value 0 prints very little, 1 prints a little bit,
        and 2 prints the test names while testing.
    xunitfile : string, optional
        If provided, writes the test results to an xunit
        style xml file. This is useful for running the tests
        in a CI server such as Jenkins.
    exit : bool, optional
        If True, the function will call sys.exit with an
        error code after the tests are finished.
    """
    import nose
    import os
    argv = ['nosetests', '--verbosity=%d' % verbosity]
    # Output an xunit file if requested
    if xunitfile:
        argv.extend(['--with-xunit', '--xunit-file=%s' % xunitfile])
    # Add all 'tests' subdirectories to the options
    rootdir = os.path.dirname(__file__)
    for root, dirs, files in os.walk(rootdir):
        if 'tests' in dirs:
            testsdir = os.path.join(root, 'tests')
            argv.append(testsdir)
            print('Test dir: %s' % testsdir[len(rootdir)+1:])
    # Ask nose to do its thing
    return nose.main(argv=argv,
                    exit=exit)

Add a nose-based blaze.test() function as a placeholder
Add a nose-based blaze.test() function as a placeholder

Hopefully we find something better, but this at least gives
us behavior similar to NumPy as a start.

  
  from constructors import array, open
  from datashape import dshape
  
+ def test(verbosity=1, xunitfile=None, exit=False):
+     """
+     Runs the full Blaze test suite, outputting
+     the results of the tests to sys.stdout.
+ 
+     This uses nose tests to discover which tests to
+     run, and runs tests in any 'tests' subdirectory
+     within the Blaze module.
+ 
+     Parameters
+     ----------
+         Value 0 prints very little, 1 prints a little bit,
+         and 2 prints the test names while testing.
+     xunitfile : string, optional
+         If provided, writes the test results to an xunit
+         style xml file. This is useful for running the tests
+         in a CI server such as Jenkins.
+     exit : bool, optional
+         If True, the function will call sys.exit with an
+         error code after the tests are finished.
+     """
+     import nose
+     import os
+     argv = ['nosetests', '--verbosity=%d' % verbosity]
+     # Output an xunit file if requested
+     if xunitfile:
+         argv.extend(['--with-xunit', '--xunit-file=%s' % xunitfile])
+     # Add all 'tests' subdirectories to the options
+     rootdir = os.path.dirname(__file__)
+     for root, dirs, files in os.walk(rootdir):
+         if 'tests' in dirs:
+             testsdir = os.path.join(root, 'tests')
+             argv.append(testsdir)
+             print('Test dir: %s' % testsdir[len(rootdir)+1:])
+     # Ask nose to do its thing
+     return nose.main(argv=argv,
+                     exit=exit)
+ 
Add a nose-based blaze.test() function as a placeholder
## Code Before:

from constructors import array, open
from datashape import dshape

## Instruction:
Add a nose-based blaze.test() function as a placeholder
## Code After:

from constructors import array, open
from datashape import dshape

def test(verbosity=1, xunitfile=None, exit=False):
    """
    Runs the full Blaze test suite, outputting
    the results of the tests to sys.stdout.

    This uses nose tests to discover which tests to
    run, and runs tests in any 'tests' subdirectory
    within the Blaze module.

    Parameters
    ----------
        Value 0 prints very little, 1 prints a little bit,
        and 2 prints the test names while testing.
    xunitfile : string, optional
        If provided, writes the test results to an xunit
        style xml file. This is useful for running the tests
        in a CI server such as Jenkins.
    exit : bool, optional
        If True, the function will call sys.exit with an
        error code after the tests are finished.
    """
    import nose
    import os
    argv = ['nosetests', '--verbosity=%d' % verbosity]
    # Output an xunit file if requested
    if xunitfile:
        argv.extend(['--with-xunit', '--xunit-file=%s' % xunitfile])
    # Add all 'tests' subdirectories to the options
    rootdir = os.path.dirname(__file__)
    for root, dirs, files in os.walk(rootdir):
        if 'tests' in dirs:
            testsdir = os.path.join(root, 'tests')
            argv.append(testsdir)
            print('Test dir: %s' % testsdir[len(rootdir)+1:])
    # Ask nose to do its thing
    return nose.main(argv=argv,
                    exit=exit)
