test.py 856 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env python
  2. # Copyright (c) 2015 Stephen Warren
  3. # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
  4. #
  5. # SPDX-License-Identifier: GPL-2.0
  6. # Wrapper script to invoke pytest with the directory name that contains the
  7. # U-Boot tests.
  8. import os
  9. import os.path
  10. import sys
  11. # Get rid of argv[0]
  12. sys.argv.pop(0)
  13. # argv; py.test test_directory_name user-supplied-arguments
  14. args = ["py.test", os.path.dirname(__file__) + "/tests"]
  15. args.extend(sys.argv)
  16. try:
  17. os.execvp("py.test", args)
  18. except:
  19. # Log full details of any exception for detailed analysis
  20. import traceback
  21. traceback.print_exc()
  22. # Hint to the user that they likely simply haven't installed the required
  23. # dependencies.
  24. print >>sys.stderr, """
  25. exec(py.test) failed; perhaps you are missing some dependencies?
  26. See test/py/README.md for the list."""