Provide meaningful message for empty environment installs (#28031)

* Provide a meaningful failure message for installation of an empty environment

* Allow regenerating view per offline discussion
This commit is contained in:
Tamara Dahlgren 2021-12-15 22:56:54 -08:00 committed by GitHub
parent 9240614928
commit ac49ce8b3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 9 deletions

View file

@ -348,17 +348,22 @@ def get_tests(specs):
env.write(regenerate=False)
specs = env.all_specs()
if not args.log_file and not reporter.filename:
reporter.filename = default_log_file(specs[0])
reporter.specs = specs
if specs:
if not args.log_file and not reporter.filename:
reporter.filename = default_log_file(specs[0])
reporter.specs = specs
# Tell the monitor about the specs
if args.use_monitor and specs:
monitor.new_configuration(specs)
# Tell the monitor about the specs
if args.use_monitor and specs:
monitor.new_configuration(specs)
tty.msg("Installing environment {0}".format(env.name))
with reporter('build'):
env.install_all(**kwargs)
tty.msg("Installing environment {0}".format(env.name))
with reporter('build'):
env.install_all(**kwargs)
else:
msg = '{0} environment has no specs to install'.format(env.name)
tty.msg(msg)
tty.debug("Regenerating environment views for {0}"
.format(env.name))

View file

@ -1099,3 +1099,15 @@ def test_install_env_with_tests_root(tmpdir, mock_packages, mock_fetch,
add('depb')
install('--test', 'root')
assert not os.path.exists(test_dep.prefix)
def test_install_empty_env(tmpdir, mock_packages, mock_fetch,
install_mockery, mutable_mock_env_path):
env_name = 'empty'
env('create', env_name)
with ev.read(env_name):
out = install(fail_on_error=False)
assert env_name in out
assert 'environment' in out
assert 'no specs to install' in out