コード例 #1
0
def test_build_feedstock_local_src_dir_args(mocker):
    """
    Tests that providing the local_src_dir argument sets the LOCAL_SRC_DIR environment variable correctly.
    """
    mocker.patch('os.path.exists', return_value=True)

    build_feedstock._set_local_src_dir("my_src_dir", None, None)
    assert os.environ["LOCAL_SRC_DIR"] == "my_src_dir"
コード例 #2
0
def test_build_feedstock_local_src_dir_recipe(mocker):
    """
    Tests that providing the local_src_dir in a recipe sets the LOCAL_SRC_DIR environment variable correctly.
    """
    mocker.patch('os.path.exists', return_value=True)

    build_feedstock._set_local_src_dir(None,
                                       {'local_src_dir': "my_other_src_dir"},
                                       "/test/location/recipe.yaml")
    assert os.environ["LOCAL_SRC_DIR"] == "/test/location/my_other_src_dir"
コード例 #3
0
def test_build_feedstock_local_src_dir_args_fail(mocker):
    """
    Tests that providing the local_src_dir argument to a non-existant file fails properly.
    """
    mocker.patch('os.path.exists', return_value=False)

    with pytest.raises(OpenCEError) as exc:
        build_feedstock._set_local_src_dir(
            "my_src_dir", {'local_src_dir': "my_other_src_dir"}, None)
    assert "local_src_dir path \"my_src_dir\" specified doesn't exist" in str(
        exc.value)
コード例 #4
0
def test_build_feedstock_local_src_dir_args_fail(mocker, capsys):
    """
    Tests that providing the local_src_dir argument to a non-existant file fails properly.
    """
    mocker.patch('os.path.exists', return_value=False)

    assert build_feedstock._set_local_src_dir(
        "my_src_dir", {'local_src_dir': "my_other_src_dir"}, None) == 1
    captured = capsys.readouterr()
    assert "ERROR: local_src_dir path \"my_src_dir\" specified doesn't exist" in captured.out