diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index 1fcbb26f5d2..b9d6758af54 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -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: diff --git a/lib/spack/spack/test/cmd/create.py b/lib/spack/spack/test/cmd/create.py index e7d8d7f8e95..20059b35d4a 100644 --- a/lib/spack/spack/test/cmd/create.py +++ b/lib/spack/spack/test/cmd/create.py @@ -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)