Add a warning on Python 2.7 deprecation (#33052)

Co-authored-by: alalazo <alalazo@users.noreply.github.com>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
Massimiliano Culpo 2022-10-06 23:42:34 +02:00 committed by GitHub
parent f43887dd4e
commit 1a12ddbd2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -547,6 +547,12 @@ def setup_main_options(args):
# Assign a custom function to show warnings
warnings.showwarning = send_warning_to_tty
if sys.version_info[:2] == (2, 7):
warnings.warn(
"Python 2.7 support is deprecated and will be removed in Spack v0.20.\n"
" Please move to Python 3.6 or higher."
)
# Set up environment based on args.
tty.set_verbose(args.verbose)
tty.set_debug(args.debug)

View File

@ -22,6 +22,9 @@
spack.main.add_all_commands(parser)
@pytest.mark.skipif(
sys.version_info[:2] == (2, 7), reason="Fails as the output contains a warning on Python 2.7"
)
def test_names():
"""Test default output of spack commands."""
out1 = commands().strip().split("\n")