Ejemplo n.º 1
0
def test_install_env_fname_none(mock_identify_env_file, mock_get_conda_bin,
                                capsys):
    install()

    expected_result = "[jovian] Error: Failed to detect a conda environment YML file. Skipping.."
    captured = capsys.readouterr()
    assert captured.err.strip() == expected_result
Ejemplo n.º 2
0
def test_install_env_name_none(mock_request_env_name, mock_get_conda_bin,
                               capsys):
    with fake_envfile():
        install('environment.yml')

        expected_result = dedent("""
            [jovian] Detected conda environment file: environment.yml

            [jovian] Environment name not provided/detected. Skipping..
            """).strip()
        captured = capsys.readouterr()
        assert captured.out.strip() == expected_result
Ejemplo n.º 3
0
def install_env(ctx, name=None):
    """Install packages from environment file:

        $ jovian install

    or, install from specific environment file

        $ jovian install environment-linux.yml
    """

    if not name:
        install()
    else:
        install(env_name=name)
Ejemplo n.º 4
0
def install_env(ctx, name=None):
    """Install packages from environment file:

        $ jovian install

    or, to specify environment name:

        $ jovian install -n my_env

    """

    if not name:
        install()
    else:
        install(env_name=name)
Ejemplo n.º 5
0
def test_install(mock_run_command, mock_request_env_name, mock_get_conda_bin):
    with fake_envfile():
        mock_run_command.return_value = True

        install('environment.yml')

        mock_run_command.assert_called_with(
            command=
            'conda env update --file "environment.yml" --name "test-env"',
            env_fname='environment.yml',
            packages=[
                'mixpanel=1.11.0', 'sigmasix=1.91.0', 'sqlite', 'six==1.11.0',
                'sqlite==2.0.0'
            ],
            run=1)
Ejemplo n.º 6
0
def install_env(ctx, name=None):
    """Install packages from environment file:

        $ jovian install

    or, install from specific environment file

        $ jovian install environment-linux.yml
    """

    if not name:
        install()
    elif name:
        install(env_name=name)
    else:
        # Show help
        sys.argv[1] = "--help"
        install_env()
Ejemplo n.º 7
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('command')
    parser.add_argument('gist', nargs='?')

    args = parser.parse_args()
    command = args.command
    if command == 'init':
        exec_init()
    elif command == 'clone':
        if not args.gist:
            print('Please provide the Gist ID to clone')
            return
        exec_clone(args.gist)
    elif command == 'pull':
        pull(args.gist)
    elif command == 'version':
        print('Jovian library version: ' + __version__)
    elif command == 'install':
        install()
    elif command == 'activate':
        activate()
Ejemplo n.º 8
0
def test_install_unsuccessful(mock_run_command, mock_request_env_name,
                              mock_get_conda_bin, capsys):
    with fake_envfile():
        mock_run_command.return_value = False

        install('environment.yml')

        expected_result = dedent("""
                            [jovian] Detected conda environment file: environment.yml

                            [jovian] Some pip packages failed to install.
                            [jovian] 
                            #
                            # To activate this environment, use
                            #
                            #     $ conda activate test-env
                            #
                            # To deactivate an active environment, use
                            #
                            #     $ conda deactivate
                        """).strip()

        captured = capsys.readouterr()
        assert captured.out.strip() == expected_result