u-boot-brain/test/py/test.py
Tom Rini fe1193e254 test/py: Automated conversion to Python 3
Use the 2to3 tool to perform numerous automatic conversions from Python
2 syntax to Python 3.  Also fix whitespace problems that Python 3
catches that Python 2 did not.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-30 17:48:47 -04:00

33 lines
875 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
# Get rid of argv[0]
sys.argv.pop(0)
# argv; py.test test_directory_name user-supplied-arguments
args = ['py.test', os.path.dirname(__file__) + '/tests']
args.extend(sys.argv)
try:
os.execvp('py.test', args)
except:
# Log full details of any exception for detailed analysis
import traceback
traceback.print_exc()
# Hint to the user that they likely simply haven't installed the required
# dependencies.
print('''
exec(py.test) failed; perhaps you are missing some dependencies?
See test/py/README.md for the list.''', file=sys.stderr)
sys.exit(1)