Exemple #1
0
def test_imr_no_attribute(mock_ws):
    """
    Should not bother looking up what's installed when there's no requirements.
    """
    module = object()
    server.install_missing_requirements(module)
    mock_ws.assert_not_called()
Exemple #2
0
def test_imr_no_attribute(mock_ws):
    """
    Should not bother looking up what's installed when there's no requirements.
    """
    module = object()
    server.install_missing_requirements(module)
    mock_ws.assert_not_called()
Exemple #3
0
def test_imr_bad_pkg_fails(mock_find):
    """
    Should raise exception when pkg installation fails.
    """
    module = mock.Mock()
    module.REQUIREMENTS = [str(uuid.uuid4())]
    with pytest.raises(server.CannotInstallModuleRequirements):
        server.install_missing_requirements(module)
Exemple #4
0
def test_imr_blank_list(mock_ws):
    """
    Should not bother looking up what's installed when there's no requirements.
    """
    module = mock.Mock()
    module.REQUIREMENTS = []
    server.install_missing_requirements(module)
    mock_ws.assert_not_called()
Exemple #5
0
def test_imr_bad_pkg_fails(mock_find):
    """
    Should raise exception when pkg installation fails.
    """
    module = mock.Mock()
    module.REQUIREMENTS = [str(uuid.uuid4())]
    with pytest.raises(server.CannotInstallModuleRequirements):
        server.install_missing_requirements(module)
Exemple #6
0
def test_imr_blank_list(mock_ws):
    """
    Should not bother looking up what's installed when there's no requirements.
    """
    module = mock.Mock()
    module.REQUIREMENTS = []
    server.install_missing_requirements(module)
    mock_ws.assert_not_called()
Exemple #7
0
def test_imr_has_requirements(mock_pip, mock_find):
    """
    Should install all missing args.
    """
    module = mock.Mock()
    module.REQUIREMENTS = ["testreq1", "testreq2==1.2.3"]
    server.install_missing_requirements(module)
    args, _ = mock_pip.call_args
    assert args == (["testreq1", "testreq2==1.2.3"],)
Exemple #8
0
def test_imr_has_requirements(mock_pip, mock_find):
    """
    Should install all missing args.
    """
    module = mock.Mock()
    module.REQUIREMENTS = ["testreq1", "testreq2==1.2.3"]
    server.install_missing_requirements(module)
    args, _ = mock_pip.call_args
    assert args == (["testreq1", "testreq2==1.2.3"], )