def test_find_format(database, config): output = find('--format', '{name}-{^mpi.name}', 'mpileaks') assert set(output.strip().split('\n')) == set([ "mpileaks-zmpi", "mpileaks-mpich", "mpileaks-mpich2", ]) output = find('--format', '{name}-{version}-{compiler.name}-{^mpi.name}', 'mpileaks') assert set(output.strip().split('\n')) == set([ "mpileaks-2.3-gcc-zmpi", "mpileaks-2.3-gcc-mpich", "mpileaks-2.3-gcc-mpich2", ]) output = find('--format', '{name}-{^mpi.name}-{hash:7}', 'mpileaks') elements = output.strip().split('\n') assert set(e[:-7] for e in elements) == set([ "mpileaks-zmpi-", "mpileaks-mpich-", "mpileaks-mpich2-", ]) # hashes are in base32 for e in elements: for c in e[-7:]: assert c in base32_alphabet
def test_find_no_sections(database, config): output = find() assert "-----------" in output output = find("--no-groups") assert "-----------" not in output assert "==>" not in output
def test_find_loaded(database, working_env): output = find('--loaded', '--group') assert output == '' os.environ[uenv.spack_loaded_hashes_var] = ':'.join( [x.dag_hash() for x in spack.store.db.query()]) output = find('--loaded') expected = find() assert output == expected
def test_find_very_long(database, config): output = find('-L', '--no-groups', "mpileaks") specs = [Spec(s).concretized() for s in [ "mpileaks ^zmpi", "mpileaks ^mpich", "mpileaks ^mpich2", ]] assert set(output.strip().split("\n")) == set([ ("%s [email protected]" % s.dag_hash()) for s in specs ])
def test_find_prefix_in_env(mutable_mock_env_path, install_mockery, mock_fetch, mock_packages, mock_archive, config): """Test `find` formats requiring concrete specs work in environments.""" env('create', 'test') with ev.read('test'): install('mpileaks') find('-p') find('-l') find('-L')
def test_find_format_deps_paths(database, config): output = find('-dp', '--format', '{name}-{version}', 'mpileaks', '^zmpi') spec = Spec("mpileaks ^zmpi").concretized() prefixes = [s.prefix for s in spec.traverse()] assert output == """\ mpileaks-2.3 {0} callpath-1.0 {1} dyninst-8.2 {2} libdwarf-20130729 {3} libelf-0.8.13 {4} zmpi-1.0 {5} fake-1.0 {6} """.format(*prefixes)
def test_find_not_found(database, config, capsys): with capsys.disabled(): output = find("foobarbaz", fail_on_error=False) assert "No package matches the query: foobarbaz" in output assert find.returncode == 1
def test_find_show_compiler(database, config): output = find('--no-groups', '--show-full-compiler', "mpileaks") assert "[email protected]%[email protected]" in output
def test_find_format_deps(database, config): output = find('-d', '--format', '{name}-{version}', 'mpileaks', '^zmpi') assert output == """\
def test_find_json_deps(database): output = find('-d', '--json', 'mpileaks') spec_list = json.loads(output) _check_json_output_deps(spec_list)
def test_namespaces_shown_correctly(database): out = find() assert 'builtin.mock.zmpi' not in out out = find('--namespace') assert 'builtin.mock.zmpi' in out
def test_find_command_basic_usage(database): output = find() assert 'mpileaks' in output
def test_bootstrap_deprecated(): output = find('--bootstrap') assert "`spack find --bootstrap` is deprecated" in output