示例#1
0
文件: build.py 项目: dmj111/conda
def test(m):
    tmp_dir = join(config.croot, 'test-tmp_dir')
    rm_rf(tmp_dir)
    os.makedirs(tmp_dir)
    if not create_files(tmp_dir, m):
        print("Nothing to test for:", m.dist())
        return

    print("TEST START:", m.dist())
    rm_rf(prefix)
    rm_rf(config.test_prefix)
    specs = ['%s %s %s' % (m.name(), m.version(), m.build_id()),
             # as the tests are run by python, we need to specify it
             'python %s*' % environ.py_ver]
    # add packages listed in test/requires
    for spec in m.get_value('test/requires'):
        specs.append(spec)

    create_env(config.test_prefix, specs)

    env = dict(os.environ)
    # prepend bin/Scripts directory
    env['PATH'] = (join(config.test_prefix, bin_dirname) + os.pathsep +
                   env['PATH'])

    for varname in 'CONDA_PY', 'CONDA_NPY':
        env[varname] = str(getattr(config, varname))
    env['PREFIX'] = config.test_prefix

    _check_call([config.test_python, join(tmp_dir, 'run_test.py')],
                env=env, cwd=tmp_dir)

    print("TEST END:", m.dist())
示例#2
0
文件: build.py 项目: Studiogit/conda
def test(m, pypi=False):
    # remove from package cache
    rm_pkgs_cache(m.dist())

    tmp_dir = join(config.croot, 'test-tmp_dir')
    rm_rf(tmp_dir)
    os.makedirs(tmp_dir)
    if not create_files(tmp_dir, m):
        print("Nothing to test for:", m.dist())
        return

    print("TEST START:", m.dist())
    rm_rf(prefix)
    rm_rf(config.test_prefix)
    specs = [
        '%s %s %s' % (m.name(), m.version(), m.build_id()),
        # as the tests are run by python, we need to specify it
        'python %s*' % environ.py_ver
    ]
    # add packages listed in test/requires
    for spec in m.get_value('test/requires'):
        specs.append(spec)

    create_env(config.test_prefix, specs, pypi)

    env = dict(os.environ)
    # prepend bin (or Scripts) directory
    env['PATH'] = (join(config.test_prefix, bin_dirname) + os.pathsep +
                   env['PATH'])

    for varname in 'CONDA_PY', 'CONDA_NPY':
        env[varname] = str(getattr(config, varname))
    env['PREFIX'] = config.test_prefix

    try:
        subprocess.check_call(
            [config.test_python,
             join(tmp_dir, 'run_test.py')],
            env=env,
            cwd=tmp_dir)
    except subprocess.CalledProcessError:
        if not isdir(broken_dir):
            os.makedirs(broken_dir)
        shutil.move(bldpkg_path(m), join(broken_dir, "%s.tar.bz2" % m.dist()))
        sys.exit("TESTS FAILED: " + m.dist())

    print("TEST END:", m.dist())
示例#3
0
文件: build.py 项目: imclab/conda
def test(m, pypi=False):
    # remove from package cache
    rm_pkgs_cache(m.dist())

    tmp_dir = join(config.croot, 'test-tmp_dir')
    rm_rf(tmp_dir)
    os.makedirs(tmp_dir)
    if not create_files(tmp_dir, m):
        print("Nothing to test for:", m.dist())
        return

    print("TEST START:", m.dist())
    rm_rf(prefix)
    rm_rf(config.test_prefix)
    specs = ['%s %s %s' % (m.name(), m.version(), m.build_id()),
             # as the tests are run by python, we need to specify it
             'python %s*' % environ.py_ver]
    # add packages listed in test/requires
    for spec in m.get_value('test/requires'):
        specs.append(spec)

    create_env(config.test_prefix, specs, pypi)

    env = dict(os.environ)
    # prepend bin (or Scripts) directory
    env['PATH'] = (join(config.test_prefix, bin_dirname) + os.pathsep +
                   env['PATH'])

    for varname in 'CONDA_PY', 'CONDA_NPY':
        env[varname] = str(getattr(config, varname))
    env['PREFIX'] = config.test_prefix

    try:
        subprocess.check_call([config.test_python, join(tmp_dir, 'run_test.py')],
            env=env, cwd=tmp_dir)
    except subprocess.CalledProcessError:
        if not isdir(broken_dir):
            os.makedirs(broken_dir)
        shutil.move(bldpkg_path(m), join(broken_dir, "%s.tar.bz2" % m.dist()))
        sys.exit("TESTS FAILED: " + m.dist())

    print("TEST END:", m.dist())