diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2022-06-22 11:45:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 18:45:03 +0000 |
commit | ef278c601cebc5a14b758d5a7f2f4ec6de80fd16 (patch) | |
tree | 0453e7f76c9714dfcfcd78eeb1fbf23912a64567 | |
parent | 5e9a8d27f723d26fc6eacd8cea00e94e65defb13 (diff) | |
download | spack-ef278c601cebc5a14b758d5a7f2f4ec6de80fd16.tar.gz spack-ef278c601cebc5a14b758d5a7f2f4ec6de80fd16.tar.bz2 spack-ef278c601cebc5a14b758d5a7f2f4ec6de80fd16.tar.xz spack-ef278c601cebc5a14b758d5a7f2f4ec6de80fd16.zip |
spack create: fix for no URL (#31239)
-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) |