spack create: fix for no URL (#31239)

This commit is contained in:
Adam J. Stewart 2022-06-22 11:45:03 -07:00 committed by GitHub
parent 5e9a8d27f7
commit ef278c601c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -826,7 +826,7 @@ def get_versions(args, name):
spack.util.url.require_url_format(args.url)
if args.url.startswith('file://'):
valid_url = False # No point in spidering these
except ValueError:
except (ValueError, TypeError):
valid_url = False
if args.url is not None and args.template != 'bundle' and valid_url:

View File

@ -160,3 +160,9 @@ def _parse_name_offset(path, v):
spack.cmd.create.get_name(args)
captured = capsys.readouterr()
assert "Couldn't guess a name" in str(captured)
def test_no_url(parser):
"""Test creation of package without a URL."""
args = parser.parse_args(['--skip-editor', '-n', 'create-new-package'])
spack.cmd.create.create(parser, args)