# Path: utils/v4l.py
# def v4l_get_name(device='video0'):
#     path_pattern = "/sys/class/video4linux/%s/name"
#     from utils.files import read_file
#     path = path_pattern %device
#     return read_file(path).strip() 
# 
# def v4l_get_devices():
#     return os.listdir('/sys/class/video4linux')
# 
# def v4l_set_current_device(device):
#     os.environ['V4L2_TEST_DEVICE'] = device
# 
# Path: utils/colors.py
# class Colors():
#     RED = '\033[91m'
#     GREEN = '\033[92m'
#     YELLOW = '\033[93m'
#     BLUE = '\033[94m'
#     PURPLE = '\033[95m'
#     TEAL = '\033[96m'
#     DEFAULT = '\033[0m'


import os
import sys
import imp
    import argparse
from utils.v4l import v4l_get_name, v4l_get_devices, v4l_set_current_device
from utils.colors import Colors

        if "v4l" in test_name:
            test_name = os.path.basename(test_name)
            for device in v4l_get_devices():
                device_path = '/dev/%s' %device
                banner = 'V4L %s test of device %s (%s)' %(test_name, v4l_get_name(), device_path)
                v4l_set_current_device(device_path)
                results.append(run_test(test_module, banner))
            else:
                print('No V4L device found, skipping test %s' %test_name)
        else:
            results.append(run_test(test_module, banner))
    print('\n###########################################')
    print('####### Tests finished, results ###########')
    print('###########################################\n')
    print("\n".join(results))

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("-t", "--test-list", help="csv-separated list of tests to run, defaults to All")
    parser.add_argument("-l", "--list-tests", help="list all available tests", action="store_true")
    args = parser.parse_args()
    if args.list_tests:
        print('Available tests:\n\t%s' %'\n\t'.join(scan_test_folder()))
        sys.exit()
    if args.test_list:
        test_files_arg = args.test_list.split(',')
        test_files = list()
        for f in test_files_arg:
            if os.path.isdir(f):

# Path: utils/v4l.py
# def v4l_get_name(device='video0'):
#     path_pattern = "/sys/class/video4linux/%s/name"
#     from utils.files import read_file
#     path = path_pattern %device
#     return read_file(path).strip() 
# 
# def v4l_get_devices():
#     return os.listdir('/sys/class/video4linux')
# 
# def v4l_set_current_device(device):
#     os.environ['V4L2_TEST_DEVICE'] = device
# 
# Path: utils/colors.py
# class Colors():
#     RED = '\033[91m'
#     GREEN = '\033[92m'
#     YELLOW = '\033[93m'
#     BLUE = '\033[94m'
#     PURPLE = '\033[95m'
#     TEAL = '\033[96m'
#     DEFAULT = '\033[0m'


# Path: run_tests.py
import os
import sys
import imp
    import argparse
from utils.v4l import v4l_get_name, v4l_get_devices, v4l_set_current_device
from utils.colors import Colors


        if "v4l" in test_name:
            test_name = os.path.basename(test_name)
            for device in v4l_get_devices():
                device_path = '/dev/%s' %device
                banner = 'V4L %s test of device %s (%s)' %(test_name, v4l_get_name(), device_path)
                v4l_set_current_device(device_path)
                results.append(run_test(test_module, banner))
            else:
                print('No V4L device found, skipping test %s' %test_name)
        else:
            results.append(run_test(test_module, banner))
    print('\n###########################################')
    print('####### Tests finished, results ###########')
    print('###########################################\n')
    print("\n".join(results))

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("-t", "--test-list", help="csv-separated list of tests to run, defaults to All")
    parser.add_argument("-l", "--list-tests", help="list all available tests", action="store_true")
    args = parser.parse_args()
    if args.list_tests:
        print('Available tests:\n\t%s' %'\n\t'.join(scan_test_folder()))
        sys.exit()
    if args.test_list:
        test_files_arg = args.test_list.split(',')
        test_files = list()
        for f in test_files_arg:
            if os.path.isdir(f):

                test_files.extend(scan_test_folder(f))