python-tuf/tests/aggregate_tests.py
Martin Vrachev fa899cca20 Simplify aggregate_tests.py
There is a simpler way to skip modules or particular tests
built-in into the unittest module.
That's why it doesn't make sense for us to manually filter
modules based on the python version we are running.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-10-30 17:16:39 +02:00

49 lines
1.2 KiB
Python
Executable file

#!/usr/bin/env python
# Copyright 2013 - 2017, New York University and the TUF contributors
# SPDX-License-Identifier: MIT OR Apache-2.0
"""
<Program Name>
aggregate_tests.py
<Author>
Konstantin Andrianov.
Zane Fisher.
<Started>
January 26, 2013.
August 2013.
Modified previous behavior that explicitly imported individual
unit tests. -Zane Fisher
<Copyright>
See LICENSE-MIT OR LICENSE for licensing information.
<Purpose>
Run all the unit tests from every .py file beginning with "test_" in
'tuf/tests'. Use --random to run the tests in random order.
"""
# Help with Python 3 compatibility, where the print statement is a function, an
# implicit relative import is invalid, and the '/' operator performs true
# division. Example: print 'hello world' raises a 'SyntaxError' exception.
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import sys
import unittest
if __name__ == '__main__':
suite = unittest.TestLoader().discover(".")
all_tests_passed = unittest.TextTestRunner(
verbosity=1, buffer=True).run(suite).wasSuccessful()
if not all_tests_passed:
sys.exit(1)
else:
sys.exit(0)