Exemplo n.º 1
0
def _get_env():
    """
    to get current environment
    :return: value mentioned in tests config ini file
    """
    try:
        return str(read_configuration('ENVIRONMENT')['target']).lower()
    except KeyError:
        raise RuntimeError(
            'target is not specified in ENVIRONMENT section of test_config.ini'
        )
 def __init__(self, client_setup):
     self._client = client_setup
     self._gpio_pin = config_reader.read_configuration(
         'VDP_BOARD')['gpio_pin']
     self._gpio_path = '/sys/class/gpio'
     self._video_path = '{}/gpio{}'.format(self._gpio_path, self._gpio_pin)
Exemplo n.º 3
0
import logging
from functools import wraps
from time import sleep

from functional_tests.config_reader import read_configuration
from pytest import exit as pytest_exit
from vhat_client import LookupError, VideoStreamingError

SECTION_NAME = 'RUN_MODE'
PARAM_NAME = 'TEST_RUN_MODE'
TEXT_FOR_EXIT_WHEN_VideoStreamingError = "Cancel pytest execution because VideoStreamingError after {} tries"

try:
    section_name = read_configuration(SECTION_NAME)[PARAM_NAME]
    exc_conf = read_configuration(section_name)
    logging.debug(
        'Reading handing exception configuration for {} MODE'.format(exc_conf))
except KeyError:
    raise KeyError(
        'Configuration is missing. Check that config [{}].{}'.format(
            SECTION_NAME, PARAM_NAME))


def get_bool_config_value(name):
    if exc_conf[name].lower() == 'true':
        return True
    elif exc_conf[name].lower() == 'false':
        return False
    else:
        raise KeyError(
            "Wrong value. Correct values for [{}] are: [True or False]".format(
Exemplo n.º 4
0
import os

import pytest
from functional_tests import config_reader
from functional_tests.utils import ssh_connect
from functional_tests.utils.sftp_connection import SftpConnection

default_folder = config_reader.read_configuration('GET_SCREENSHOT')['location']
folder_name = 'screenshots'
folder_path = '{}/{}'.format(default_folder, folder_name)
images_dir = 'images_to_compare'
zero_size_file = 'zero.png'
unsupport_type_file = 'unsupport.txt'


@pytest.fixture(scope='module')
def create_temporary_folder(app_connector):
    client = ssh_connect.start()
    ssh_connect.execute_command(client,
                                'rm -r "{}"'.format(folder_path),
                                ignore_error=True)
    ssh_connect.execute_command(client, 'mkdir {}'.format(folder_path))
    yield client
    ssh_connect.execute_command(client,
                                'rm -r "{}"'.format(folder_path),
                                ignore_error=True)


@pytest.fixture(scope='module')
def copy_test_files_to_board(create_temporary_folder):
    sftp_client = SftpConnection()