From ef278c601cebc5a14b758d5a7f2f4ec6de80fd16 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 22 Jun 2022 11:45:03 -0700 Subject: spack create: fix for no URL (#31239) --- lib/spack/spack/cmd/create.py | 2 +- lib/spack/spack/test/cmd/create.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index 1fcbb26f5d..b9d6758af5 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 e7d8d7f8e9..20059b35d4 100644 --- a/lib/spack/spack/test/cmd/create.py +++ b/lib/spack/spack/test/cmd/create.py @@ -160,3 +160,9 @@ def test_get_name_error(parser, monkeypatch, capsys): 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) -- cgit v1.2.3-60-g2f50