spack create: fix for no URL (#31239)
This commit is contained in:
		@@ -826,7 +826,7 @@ def get_versions(args, name):
 | 
				
			|||||||
        spack.util.url.require_url_format(args.url)
 | 
					        spack.util.url.require_url_format(args.url)
 | 
				
			||||||
        if args.url.startswith('file://'):
 | 
					        if args.url.startswith('file://'):
 | 
				
			||||||
            valid_url = False  # No point in spidering these
 | 
					            valid_url = False  # No point in spidering these
 | 
				
			||||||
    except ValueError:
 | 
					    except (ValueError, TypeError):
 | 
				
			||||||
        valid_url = False
 | 
					        valid_url = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if args.url is not None and args.template != 'bundle' and valid_url:
 | 
					    if args.url is not None and args.template != 'bundle' and valid_url:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,3 +160,9 @@ def _parse_name_offset(path, v):
 | 
				
			|||||||
        spack.cmd.create.get_name(args)
 | 
					        spack.cmd.create.get_name(args)
 | 
				
			||||||
    captured = capsys.readouterr()
 | 
					    captured = capsys.readouterr()
 | 
				
			||||||
    assert "Couldn't guess a name" in str(captured)
 | 
					    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)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user