Example #1
0
def test_about_json_content(test_metadata):
    api.build(test_metadata)
    fn = api.get_output_file_path(test_metadata)
    about = json.loads(package_has_file(fn, 'info/about.json').decode())
    assert 'conda_version' in about and about['conda_version'] == conda.__version__
    assert 'conda_build_version' in about and about['conda_build_version'] == __version__
    assert 'channels' in about and about['channels']
    try:
        assert 'env_vars' in about and about['env_vars']
    except AssertionError:
        # new versions of conda support this, so we should raise errors.
        if VersionOrder(conda.__version__) >= VersionOrder('4.2.10'):
            raise
        else:
            pass

    assert 'root_pkgs' in about and about['root_pkgs']
    assert workdir != metadata.config.work_dir

    testing_config.clean()


def test_workdir_removal_warning(testing_config, caplog):
    recipe = os.path.join(metadata_dir, '_test_uses_src_dir')
    with pytest.raises(ValueError) as exc:
        api.build(recipe, config=testing_config)
        assert "work dir is removed" in str(exc)


@pytest.mark.skipif(
    not sys.platform.startswith('linux'),
    reason="cross compiler packages created only on Linux right now")
@pytest.mark.xfail(VersionOrder(conda.__version__) < VersionOrder('4.3.2'),
                   reason="not completely implemented yet")
def test_cross_compiler(testing_workdir, testing_config, capfd):
    # TODO: testing purposes.  Package from @mingwandroid's channel, copied to conda_build_test
    testing_config.channel_urls = ('conda_build_test', )
    # activation is necessary to set the appropriate toolchain env vars
    testing_config.activate = True
    # testing_config.debug = True
    recipe_dir = os.path.join(metadata_dir, '_cross_helloworld')
    output = api.build(recipe_dir, config=testing_config)[0]
    assert output.startswith(
        os.path.join(testing_config.croot, 'linux-imx351uc'))


@pytest.mark.skipif(sys.platform != 'darwin', reason="relevant to mac only")
def test_append_python_app_osx(testing_config):