mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 10:26:10 +01:00 
			
		
		
		
	With Pytest 6.0.2 'make tests' fails:
sandbox: Traceback (most recent call last):
  File "./test/py/test.py", line 20, in <module>
    sys.exit(load_entry_point('pytest', 'console_scripts', 'pytest')(args))
TypeError: console_main() takes 0 positional arguments but 1 was given
The definition of console_scripts has changed as follows:
Pytest 4.6.1:
[options.entry_points]
console_scripts =
        pytest=pytest:main
        py.test=pytest:main
        
Pytest 6.0.2:
        
[options.entry_points]
console_scripts =
    pytest=pytest:console_main
    py.test=pytest:console_main
The new function console_main() has a comment:
"This function is not meant for programmable use; use `main()`"
Hence let's call pytest.main() directly.
Move args processing into the __main__ paragraph.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Tom Rini <trini@konsulko.com>
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			550 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			550 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env python3
 | |
| # SPDX-License-Identifier: GPL-2.0
 | |
| 
 | |
| # Copyright (c) 2015 Stephen Warren
 | |
| # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
 | |
| 
 | |
| # Wrapper script to invoke pytest with the directory name that contains the
 | |
| # U-Boot tests.
 | |
| 
 | |
| import os
 | |
| import os.path
 | |
| import sys
 | |
| import pytest
 | |
| from pkg_resources import load_entry_point
 | |
| 
 | |
| if __name__ == '__main__':
 | |
|     # argv; py.test test_directory_name user-supplied-arguments
 | |
|     args = [os.path.dirname(__file__) + '/tests']
 | |
|     args.extend(sys.argv)
 | |
|     sys.exit(pytest.main(args))
 |