def test_component_long_help(): assert DataladInstaller.long_help("datalad_installer", "miniconda") == ( "Usage: datalad_installer [<options>] miniconda [<options>]\n" "\n" " Install Miniconda\n" "\n" "Options:\n" " --batch Run in batch (noninteractive) mode\n" " -e, --extra-args EXTRA_ARGS Extra arguments to pass to the install\n" " command\n" " --path PATH Install Miniconda at the given path\n" " --spec SPEC Space-separated list of package\n" " specifiers to install in the Miniconda\n" " environment\n" " -h, --help Show this help information and exit" )
def test_versioned_component_long_help(): assert DataladInstaller.long_help("datalad_installer", "git-annex") == ( "Usage: datalad_installer [<options>] git-annex[=VERSION] [<options>]\n" "\n" " Install git-annex\n" "\n" "Options:\n" " --build-dep Install build-dep instead of the package\n" " -e, --extra-args EXTRA_ARGS Extra arguments to pass to the install\n" " command\n" " --install-dir DIR Directory in which to unpack the `*.deb`\n" " -m, --method [auto|apt|brew|neurodebian|deb-url|autobuild|snapshot|" "conda|datalad/git-annex:tested|datalad/git-annex|datalad/packages|dmg]\n" " Select the installation method to use\n" " --path PATH Path to local `*.dmg` to install\n" " --url URL URL from which to download `*.deb` file\n" " -h, --help Show this help information and exit" )
def test_global_long_help(): assert DataladInstaller.long_help("datalad_installer") == ( "Usage: datalad_installer [<options>] [COMPONENT[=VERSION] [<options>]] ...\n" "\n" " Installation script for Datalad and related components\n" "\n" "Options:\n" " -E, --env-write-file ENV_WRITE_FILE\n" " Append PATH modifications and other\n" " shell commands to the given file; can be\n" " given multiple times\n" " -l, --log-level LEVEL Set logging level [default: INFO]\n" " --sudo [ask|error|ok] How to handle sudo commands [default:\n" " ask]\n" " -V, --version Show program version and exit\n" " -h, --help Show this help information and exit\n" "\n" "Components:\n" " conda-env Create a Conda environment\n" " datalad Install Datalad\n" " git-annex Install git-annex\n" " miniconda Install Miniconda\n" " neurodebian Install & configure NeuroDebian\n" " venv Create a Python virtual environment")
def test_versioned_component_short_help(): assert DataladInstaller.short_help("datalad_installer", "git-annex") == ( "Usage: datalad_installer [<options>] git-annex[=VERSION] [<options>]")
def test_component_short_help(): assert DataladInstaller.short_help("datalad_installer", "miniconda") == ( "Usage: datalad_installer [<options>] miniconda [<options>]")
def test_global_short_help(): assert DataladInstaller.short_help("datalad_installer") == ( "Usage: datalad_installer [<options>] [COMPONENT[=VERSION] [<options>]] ..." )
def test_parse_args_errors(args, message, component): with pytest.raises(UsageError) as excinfo: DataladInstaller.parse_args(args) assert str(excinfo.value) == message assert excinfo.value.component == component
def test_parse_args(args, parsed): assert DataladInstaller.parse_args(args) == parsed