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
					Massimiliano Culpo
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							f43887dd4e
						
					
				
				
					commit
					1a12ddbd2d
				
			| @@ -547,6 +547,12 @@ def setup_main_options(args): | |||||||
|     # Assign a custom function to show warnings |     # Assign a custom function to show warnings | ||||||
|     warnings.showwarning = send_warning_to_tty |     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. |     # Set up environment based on args. | ||||||
|     tty.set_verbose(args.verbose) |     tty.set_verbose(args.verbose) | ||||||
|     tty.set_debug(args.debug) |     tty.set_debug(args.debug) | ||||||
|   | |||||||
| @@ -22,6 +22,9 @@ | |||||||
| spack.main.add_all_commands(parser) | 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(): | def test_names(): | ||||||
|     """Test default output of spack commands.""" |     """Test default output of spack commands.""" | ||||||
|     out1 = commands().strip().split("\n") |     out1 = commands().strip().split("\n") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user