diff options
-rw-r--r-- | lib/spack/spack/cmd/create.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/create.py | 6 |
2 files changed, 7 insertions, 1 deletions
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) |