Пример #1
0
def update(specs, name, remove, channel):
    """Update the history with added or removed packages."""
    # pylint: disable=redefined-outer-name,function-redefined
    name = _infer_name_if_necessary(name)
    if specs or remove:
        main.update_packages(name=name, specs=specs, remove=remove)
    if channel:
        main.update_channels(name=name, channels=channel)
Пример #2
0
def test_update_remove(expected_update):
    update_packages(name="test-update", specs=[], remove=["pandas"])
    history = expected_update
    assert history.packages == {"conda": {}}
    assert history.logs == [
        "conda install pandas",
        "conda remove --name test-update pandas",
    ]
    assert history.actions == [
        "conda create --name test-update pandas --override-channels --strict-channel-priority "
        "--channel conda-forge",
        "conda remove --name test-update pandas --override-channels "
        "--channel conda-forge",
    ]
Пример #3
0
def test_update_add(expected_update):
    update_packages(name="test-update", specs=["pytest"], remove=[])
    history = expected_update
    assert history.packages == {
        "conda": {
            "pandas": Package("pandas", "pandas", "0.23", "py36"),
            "pytest": Package("pytest", "pytest", "0.1", "py36"),
        }
    }
    assert history.logs == [
        "conda install pandas",
        "conda install --name test-update pytest",
    ]
    assert history.actions == [
        "conda create --name test-update pandas "
        "--override-channels --strict-channel-priority "
        "--channel conda-forge",
        "conda install --name test-update pytest=0.1=py36 "
        "--override-channels --strict-channel-priority "
        "--channel conda-forge",
    ]