Exemplo n.º 1
0
def test_activate_env_name_none(mock_get_conda_bin, mock_extract_env_name,
                                capsys):
    with fake_envfile():
        activate('environment.yml')

        expected_result = """[jovian] Environment name not provided/detected. Skipping.."""

        captured = capsys.readouterr()
        assert expected_result.strip() in captured.out.strip()
Exemplo n.º 2
0
def test_activate(mock_get_conda_bin, capsys):
    with fake_envfile():
        activate('environment.yml')

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

            [jovian] Copy and execute the following command (try "source activate" if "conda activate doesn't work" )
                conda activate test-env
        """).strip()

        captured = capsys.readouterr()
        assert expected_result.strip() in captured.out.strip()
Exemplo n.º 3
0
def test_activate_conda_not_found(mock_get_conda_bin, capsys):
    with fake_envfile():
        assert activate('environment.yml') == False

        expected_result = """[jovian] Error: Anaconda binary not found. Please make sure the "conda" command is in your system PATH or the environment variable $CONDA_EXE points to the anaconda binary"""

        captured = capsys.readouterr()
        assert expected_result.strip() in captured.err.strip()
Exemplo n.º 4
0
def test_activate_env_fname_none(mock_get_conda_bin, mock_identify_env_file,
                                 capsys):
    with fake_envfile():
        assert activate('environment.yml') == False

        expected_result = """[jovian] Error: Failed to detect a conda environment YML file. Skipping.."""

        captured = capsys.readouterr()
        assert expected_result.strip() in captured.err.strip()
Exemplo n.º 5
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()
Exemplo n.º 6
0
def activate_env(ctx):
    """Activate conda environment from environment file."""

    activate()