# Path: utils/process.py
# def check_cmd(cmd, shell=False, complain=True):
#     try:
#         run_cmd(cmd, shell=shell)
#         return True, 'no errors'
#     except Exception as e:
#         if complain:
#             print(e)
#         return False, e
# 
# Path: utils/v4l.py
# def v4l_get_current_device():
#     return os.environ.get('V4L2_TEST_DEVICE', '/dev/video0')


import os
from utils.process import check_cmd 
from utils.v4l import v4l_get_current_device
    from utils.run import run_test
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015, Florent Thiery 


cmd_pattern = "gst-launch-1.0 v4l2src device=%s num-buffers=1 ! fakesink"  

def run():
    input('Please make sure that input is NOT connected')
    print('Running test')
    result, info = check_cmd(cmd_pattern %v4l_get_current_device())
    input('Please make sure that input connected again')

# Path: utils/process.py
# def check_cmd(cmd, shell=False, complain=True):
#     try:
#         run_cmd(cmd, shell=shell)
#         return True, 'no errors'
#     except Exception as e:
#         if complain:
#             print(e)
#         return False, e
# 
# Path: utils/v4l.py
# def v4l_get_current_device():
#     return os.environ.get('V4L2_TEST_DEVICE', '/dev/video0')


# Path: tests/v4l/capture_without_input.py
import os
from utils.process import check_cmd 
from utils.v4l import v4l_get_current_device
    from utils.run import run_test

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015, Florent Thiery 


cmd_pattern = "gst-launch-1.0 v4l2src device=%s num-buffers=1 ! fakesink"  

def run():
    input('Please make sure that input is NOT connected')
    print('Running test')
    result, info = check_cmd(cmd_pattern %v4l_get_current_device())
    input('Please make sure that input connected again')

    return result, info