# -*-coding:utf-8 -*- # @Time : 2020/2/5 12:14 # @File : data_upload_task.py # @User : yangchuan # @Desc : test result data uploads to upper application from PyQt5.QtCore import QThread, pyqtSignal from datetime import datetime import time import json import requests from common.logConfig import Logger logger = Logger.module_logger("TaskDataResultUpload") class TaskDataResultUpload(QThread): """ test result data uploads to upper application _signal:signal for post operation status, caller has slot function for callback result: bool flag for post operation status """ _signal = pyqtSignal(object) result = False def __init__(self, url, data, parent=None): """ init function :param url: post url destination :param data: post data,dict object which is valid json format
from PyQt5.QtCore import QThread, pyqtSignal import time from modules.general.frame_loss import start_test from renix_py_api import renix from common.logConfig import Logger import random from common.info import Constants from renix_py_api.renix_common_api import get_sys_entry from renix_py_api.renix import * import logging, time from renix_py_api.api_gen import * from renix_py_api.core import EnumRelationDirection from renix_py_api.rom_manager import * logger = Logger.module_logger("TestProcessEcomNs1") class TestProcessEcomNs1(QThread): """ Ecom Ns2 switcher test process thread """ _signal = pyqtSignal(str, object) _signalInfo = pyqtSignal(str, object) port1 = "" port2 = "" def __init__(self, parent=None): super(TestProcessEcomNs1, self).__init__() self.test_case = None
""" from PyQt5.QtCore import pyqtSlot, QPoint, Qt from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QDialog, QGraphicsItem from PyQt5.QtCore import pyqtSignal from PyQt5 import QtGui, QtWidgets, QtCore import os from .Ui_SIMPLE_TEST_PROCESS_2BTN import Ui_Dialog from PyQt5.QtCore import pyqtSignal from common.info import Constants from PyQt5 import QtGui from common.logConfig import Logger logger = Logger.module_logger("DialogSimpleTestProcess2Btn") class DialogSimpleTestProcess2Btn(QDialog, Ui_Dialog): """ Class documentation goes here. """ _signalFinish = pyqtSignal(str, object) _msg = {"1": "next", "2": "case_finish"} test_item = "" def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget
""" from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QApplication from PyQt5.QtCore import pyqtSignal import os import frozen_dir from .Ui_ECOM_NS1_KEY_TEST import Ui_Dialog from common.logConfig import Logger from .ecom_ns1_test_process import TestProcessEcomNs1 from common.config import EcomNs1TestModuleConfig from common.info import Constants, ThCommonNoticeInfo, SystemLanguage SETUP_DIR = frozen_dir.app_path() logger = Logger.module_logger("DialogEcomNs1KeyTest") class DialogEcomNs1KeyTest(QDialog, Ui_Dialog): """ Class documentation goes here. """ _signalFinish = pyqtSignal(str, object) current_test_case = () current_test_step = 1 current_test_item = 1 max_test_steps = 24 test_result = {} current_test_button_status = "next" def __init__(self, parent=None):
from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QMessageBox from .Ui_SDSL_COM import Ui_Dialog from common.logConfig import Logger from common.serial_port_utility import ThSerialPortUtility from .SDSL_CONSTANT import ModuleConstants import serial import serial.threaded import time from common.info import Constants logger = Logger.module_logger("sdsl com test") class DialogSdslCom(QDialog, Ui_Dialog): """ Class documentation goes here. """ _signalFinish = pyqtSignal(str, object) test_result = {} def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget @type QWidget
from PyQt5.QtCore import pyqtSlot, pyqtSignal from PyQt5.QtWidgets import QDialog from modules.general.frame_loss import start_test from renix_py_api.renix_common_api import get_sys_entry from renix_py_api.renix import * from renix_py_api.api_gen import * from renix_py_api.core import EnumRelationDirection from renix_py_api.rom_manager import * from common.logConfig import Logger from renix_py_api.renix import initialize from .Ui_TestProcess import Ui_Dialog logger = Logger.module_logger("TestProcess") class DialogTestProcess(QDialog, Ui_Dialog): """ Class documentation goes here. """ _signalFinish = pyqtSignal(str, object) test_result = {} def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget @type QWidget
# -*-coding:utf-8 -*- # @Time : 2020/2/2 10:56 # @File : network_tools.py # @User : yangchuan # @Desc : network test methods from pythonping import ping from common.logConfig import Logger from common.data_checker import ThDataChecker logger = Logger.module_logger("ThNetWordTestCase") class ThNetworkTestCase: def __init__(self): pass @staticmethod def ping(ip, timeout, packet_counts): """ ping the specific ip address :param ip: ip address with string format :param timeout: ping timeout seconds :param packet_counts: send packet counts :return: bool,responseList object """ try: if not ThDataChecker.is_ip(ip): return False, None result = ping(ip, verbose=False,
from PyQt5.QtCore import QThread, pyqtSignal import time from modules.general.frame_loss import start_test from renix_py_api import renix from common.logConfig import Logger import random from common.info import Constants from renix_py_api.renix_common_api import get_sys_entry from renix_py_api.renix import * import logging, time from renix_py_api.api_gen import * from renix_py_api.core import EnumRelationDirection from renix_py_api.rom_manager import * logger = Logger.module_logger("TestProcessRouter") class TestProcessRouter(QThread): """ Ecom Ns2 switcher test process thread """ _signal = pyqtSignal(str, object) _signalInfo = pyqtSignal(str, object) port1 = "" port2 = "" def __init__(self, parent=None): super(TestProcessRouter, self).__init__() self.test_case = None
from PyQt5.QtCore import pyqtSlot, QPoint, Qt from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QDialog, QGraphicsItem from PyQt5.QtCore import pyqtSignal from PyQt5 import QtGui, QtWidgets, QtCore import os from modules.VHF_radio.Ui_TEST2 import Ui_Dialog from PyQt5.QtCore import pyqtSignal from common.info import Constants from PyQt5 import QtGui from common.logConfig import Logger from PyQt5.QtWidgets import QMessageBox from modules.VHF_radio.VHF_radio_CONSTANT import ModuleConstants logger = Logger.module_logger("DialogTest7point5") class DialogTest7point5(QDialog, Ui_Dialog): """ Class documentation goes here. """ signalTest = pyqtSignal(object) signalPrint = pyqtSignal(object) def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget @type QWidget """ super(DialogTest7point5, self).__init__(parent)
import os from pathlib import Path import json from PyQt5.QtWidgets import QMessageBox, QWidget from common.logConfig import Logger import frozen_dir logger = Logger.module_logger("baseconfig") SETUP_DIR = frozen_dir.app_path() class BaseConfig: """ parent class load the config file into object """ def __init__(self, file_name): self.config_directory = "conf" self.full_config_file = os.path.join(SETUP_DIR, self.config_directory, file_name) return def read_config(self): """ read config json format file info database object :return: json database object """ try: data = None
from modules.security_machine.SecurityMain import DialogSecurityMain from modules.VHF_radio.VHF_radio_MAIN import VHFradioMain from modules.mw1500_device.mw1500_device import MW1500_DEVICE from PyQt5.QtCore import pyqtSignal from PyQt5 import QtCore from common.logConfig import Logger from common.config import SystemConfig from common.info import MainWindowConstants, Constants, SystemLanguage from qss.load_qss import LoadQSS import time import frozen_dir import os from Ui_MainWindow import Ui_MainWindow logger = Logger.module_logger("main") SETUP_DIR = frozen_dir.app_path() class MainWindow(QMainWindow, Ui_MainWindow): """ Class documentation goes here. """ def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget @type QWidget """ super(MainWindow, self).__init__(parent)
import os import subprocess import logging import logging.handlers import datetime import platform from gevent.socket import create_connection import traceback import struct import importlib import atexit import enum from common.logConfig import Logger logger = Logger.module_logger("renix") # logger = None sys_entry = None class LogHandle(enum.Enum): LOG_FILE = 0 LOG_CONSOLE = 1 LOG_FILE_AND_CONSOLE = 2 def init_log(log_level, log_handle): """ crate log file and set log level :param log_level: :param log_handle:
from renix_py_api.renix import * import logging, time from renix_py_api.api_gen import * from renix_py_api.core import EnumRelationDirection from renix_py_api.rom_manager import * from common.logConfig import Logger from common.info import TestParameters logger = Logger.module_logger("network com frame loss test") def add_statistic(stream, rxPort, mode=EnumRxPortSelectMode.ONE_TO_ONE): streamHandleList = stream.handle rxPortHandleList = rxPort.handle select_rxPort_cmd = SelectRxPortCommand(StreamList=streamHandleList, RxPortList=rxPortHandleList, Mode=mode) select_rxPort_cmd.execute() stream.get_relatives('RxPort', EnumRelationDirection.TARGET, 'Port') stream.get() def create_ports(sys_entry, locations): renix_info('Create ports with locations: '.format(locations)) port1 = Port(upper=sys_entry, Location=locations[0]) port2 = Port(upper=sys_entry, Location=locations[1]) assert port1.handle assert port2.handle bring_port_online_cmd = BringPortsOnlineCommand( PortList=[port1.handle, port2.handle]) bring_port_online_cmd.execute()
from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog from PyQt5.QtCore import pyqtSignal from PyQt5 import QtGui from PyQt5.QtWidgets import QMessageBox import os from .Ui_COM_CONTROL_DEVICE_EXECUTE2 import Ui_Dialog from common.info import Constants, ThCommonNoticeInfo from .testResult import TestDataProtocolTransferAndControl1 from .test_process import ThComControlDeviceTestProcess, UdpServerThread from common.data_checker import ThDataChecker from common.logConfig import Logger from .com_control_device_constant import ModuleConstants logger = Logger.module_logger("DialogComControlDeviceExecute2") class DialogComControlDeviceExecute2(QDialog, Ui_Dialog): """ _signalFinish:str,signal for com_control_device main form to send information or results test_result:dict,test result """ _signalFinish = pyqtSignal(str, object) test_result = {} def __init__(self, parent=None): """ Constructor
# -*-coding:utf-8 -*- # @Time : 2020/1/30 11:37 # @File : data_storage.py # @User : yangchuan # @Desc : test database storage import os import frozen_dir from common.logConfig import Logger import json import uuid import sqlite3 from datetime import datetime from database.test_results_model import TestResultBase, TestValue, TestParam, TestItem logger = Logger.module_logger("ThTestResultsStorage") SETUP_DIR = frozen_dir.app_path() class ThTestResultsStorage: """ test case result store process: (1) generate result json file and write file to disk (2) store test case record into sqlite demo: test package:test_results.py """ @staticmethod def check_file_folder(folder_path): """ check the test result storage file path is existed :param folder_path: file folder by absolutely file path
Module implementing DialogEcomNs2Ping. """ from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog from PyQt5.QtCore import pyqtSignal from PyQt5 import QtGui from PyQt5.QtWidgets import QMessageBox import os from .Ui_ECOM_NS2_Ping import Ui_Dialog from common.logConfig import Logger from common.data_checker import ThDataChecker from common.network_tools import ThNetworkTestCase logger = Logger.module_logger("EcomNs2Ping") class EcomNs2Ping(QDialog, Ui_Dialog): """ Class documentation goes here. """ _signalFinish = pyqtSignal(str, object) test_result = {} def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget @type QWidget
""" Module implementing DialogRouterLanTest. """ from PyQt5.QtCore import pyqtSlot, pyqtSignal from PyQt5.QtWidgets import QDialog import os import frozen_dir from common.config import RouterLanTestModuleConfig from common.logConfig import Logger from .router_test_process import TestProcessRouter from modules.router.Ui_Router_Lan_test import Ui_Dialog from common.info import Constants, ThCommonNoticeInfo, SystemLanguage SETUP_DIR = frozen_dir.app_path() logger = Logger.module_logger("RouterLanTest") class DialogRouterLanTest(QDialog, Ui_Dialog): """ Class documentation goes here. """ _signalFinish = pyqtSignal(str, object) current_test_case = () current_test_step = 1 current_test_item = 1 max_test_steps = 24 test_result = {} current_test_button_status = "next"
from PyQt5.QtCore import pyqtSlot, QPoint, Qt from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QDialog, QGraphicsItem from PyQt5.QtCore import pyqtSignal from PyQt5 import QtGui, QtWidgets, QtCore import os from modules.VHF_radio.Ui_TEST2 import Ui_Dialog from PyQt5.QtCore import pyqtSignal from common.info import Constants from PyQt5 import QtGui from common.logConfig import Logger from modules.VHF_radio.TEST6 import DialogTest6 from PyQt5.QtWidgets import QMessageBox from modules.VHF_radio.VHF_radio_CONSTANT import ModuleConstants logger = Logger.module_logger("DialogTest7") class DialogTest7(QDialog, Ui_Dialog): """ Class documentation goes here. """ signalFinish1 = pyqtSignal(str, object) signalFinish2 = pyqtSignal(str, object) signalTest=pyqtSignal(object) def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget @type QWidget """
# -*-coding:utf-8 -*- import os import frozen_dir from common.logConfig import Logger logger = Logger.module_logger("LoadQssStyleLogger") SETUP_DIR = frozen_dir.app_path() # 加载qss类 class LoadQSS: def __init__(self): super().__init__() @staticmethod def load(): """ load qss style file :param self: :return: qss """ config_file_path = os.path.join(SETUP_DIR, "qss", "style.qss") try: with open(config_file_path, 'r') as f: style = f.readlines() style = ''.join(style).strip('\n') return style except IOError as err: logger.error("load QSS Error" + str(err))