Best Python code snippet using tappy_python
add_win.py
Source:add_win.py
1# -*- coding: utf-8 -*-2# Form implementation generated from reading ui file 'add_win.ui'3#4# Created by: PyQt5 UI code generator 5.15.45#6# WARNING: Any manual changes made to this file will be lost when pyuic5 is7# run again. Do not edit this file unless you know what you are doing.8import sys9import time10import cv211from PyQt5 import QtCore, QtGui, QtWidgets12from PyQt5.QtGui import QImage, QPixmap13from PyQt5.QtWidgets import QMainWindow, QApplication, QFileDialog, QMessageBox14import person_dao_impl15from face import getFaceLocations, getFaceEncode, getFaceOf16from model import Person17from tools import getKeyByValue, saveRGB2JPG, getCurDateTime18class Ui_add_win(object):19 def setupUi(self, add_win):20 add_win.setObjectName("add_win")21 add_win.resize(504, 409)22 self.verticalLayoutWidget = QtWidgets.QWidget(add_win)23 self.verticalLayoutWidget.setGeometry(QtCore.QRect(70, 50, 342, 311))24 self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")25 self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)26 self.verticalLayout.setContentsMargins(0, 0, 0, 0)27 self.verticalLayout.setObjectName("verticalLayout")28 self.ADD_frame_label = QtWidgets.QLabel(self.verticalLayoutWidget)29 self.ADD_frame_label.setObjectName("ADD_frame_label")30 self.verticalLayout.addWidget(self.ADD_frame_label)31 self.horizontalLayout_2 = QtWidgets.QHBoxLayout()32 self.horizontalLayout_2.setObjectName("horizontalLayout_2")33 spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)34 self.horizontalLayout_2.addItem(spacerItem)35 self.label = QtWidgets.QLabel(self.verticalLayoutWidget)36 self.label.setObjectName("label")37 self.horizontalLayout_2.addWidget(self.label)38 self.ADD_name_edit = QtWidgets.QLineEdit(self.verticalLayoutWidget)39 self.ADD_name_edit.setEnabled(False)40 self.ADD_name_edit.setObjectName("ADD_name_edit")41 self.horizontalLayout_2.addWidget(self.ADD_name_edit)42 spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)43 self.horizontalLayout_2.addItem(spacerItem1)44 self.verticalLayout.addLayout(self.horizontalLayout_2)45 self.horizontalLayout_3 = QtWidgets.QHBoxLayout()46 self.horizontalLayout_3.setObjectName("horizontalLayout_3")47 spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)48 self.horizontalLayout_3.addItem(spacerItem2)49 self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget)50 self.label_2.setObjectName("label_2")51 self.horizontalLayout_3.addWidget(self.label_2)52 self.ADD_comboBox = QtWidgets.QComboBox(self.verticalLayoutWidget)53 self.ADD_comboBox.setEnabled(False)54 self.ADD_comboBox.setObjectName("ADD_comboBox")55 self.horizontalLayout_3.addWidget(self.ADD_comboBox)56 spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)57 self.horizontalLayout_3.addItem(spacerItem3)58 self.verticalLayout.addLayout(self.horizontalLayout_3)59 self.horizontalLayout = QtWidgets.QHBoxLayout()60 self.horizontalLayout.setObjectName("horizontalLayout")61 self.ADD_imageface_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)62 self.ADD_imageface_btn.setObjectName("ADD_imageface_btn")63 self.horizontalLayout.addWidget(self.ADD_imageface_btn)64 self.ADD_cameraface_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)65 self.ADD_cameraface_btn.setObjectName("ADD_cameraface_btn")66 self.horizontalLayout.addWidget(self.ADD_cameraface_btn)67 self.ADD_OK = QtWidgets.QPushButton(self.verticalLayoutWidget)68 self.ADD_OK.setEnabled(False)69 self.ADD_OK.setObjectName("ADD_OK")70 self.horizontalLayout.addWidget(self.ADD_OK)71 self.ADD_cancel = QtWidgets.QPushButton(self.verticalLayoutWidget)72 self.ADD_cancel.setObjectName("ADD_cancel")73 self.horizontalLayout.addWidget(self.ADD_cancel)74 self.verticalLayout.addLayout(self.horizontalLayout)75 self.verticalLayout.setStretch(0, 4)76 self.retranslateUi(add_win)77 QtCore.QMetaObject.connectSlotsByName(add_win)78 def retranslateUi(self, add_win):79 _translate = QtCore.QCoreApplication.translate80 add_win.setWindowTitle(_translate("add_win", "Form"))81 self.ADD_frame_label.setText(_translate("add_win", "请ç¹å»ä¸æ¹æé®è·å人è¸"))82 self.label.setText(_translate("add_win", "ç¨æ·å称"))83 self.label_2.setText(_translate("add_win", "ç¨æ·ç±»å"))84 self.ADD_imageface_btn.setText(_translate("add_win", "ä»å¾çè·å"))85 self.ADD_cameraface_btn.setText(_translate("add_win", "å®æ¶äººè¸"))86 self.ADD_OK.setText(_translate("add_win", "ç¡®å®"))87 self.ADD_cancel.setText(_translate("add_win", "åæ¶"))88 self.ADD_frame_label.setFixedSize(200,200)89class AddPersonForm(QMainWindow, Ui_add_win):90 def __init__(self, channelDict,parent=None):91 super(AddPersonForm, self).__init__(parent)92 self.setupUi(self)93 self.channelDict = channelDict94 self.labelSize = (int(self.ADD_frame_label.width()), int(self.ADD_frame_label.height()))95 self.PDI = person_dao_impl.PersonDaoImpl()96 self.frame = None97 self.faceEncode = None98 self.img = None99 self.init()100 self.connect()101 def init(self):102 # æ´æ°combox103 for values in self.channelDict["personClass"].values():104 self.ADD_comboBox.addItem(values)105 self.ADD_comboBox.setCurrentIndex(0)106 def connect(self):107 self.ADD_cameraface_btn.clicked.connect(self.getCameraFace)108 self.ADD_imageface_btn.clicked.connect(self.getFileFace)109 self.ADD_OK.clicked.connect(self.OK_btn)110 self.ADD_cancel.clicked.connect(self.close)111 # å¾çè¾å
¥112 def getFileFace(self):113 imgName, imgType = QFileDialog.getOpenFileName(self, "æå¼å¾ç", "", "*.jpg;;*.png;;All Files(*)")114 if imgName == "":115 return116 else:117 imgName = imgName.replace('\\', '/')118 cv2Image = cv2.imread(imgName)119 img = cv2.cvtColor(cv2Image, cv2.COLOR_BGR2RGB)120 faceLocation = getFaceLocations(img)121 if len(faceLocation) == 0:122 QMessageBox.warning(self, 'è¦å', '没æè¯å«å°äººè¸ï¼',QMessageBox.Yes)123 return124 else:125 self.faceEncode = getFaceEncode(img,faceLocation)[0]126 # å¾ç转æ¢127 shrink = cv2.resize(cv2Image, self.labelSize, interpolation=cv2.INTER_AREA)128 # æ´æ¹ç¼ç 129 shrink = cv2.cvtColor(shrink, cv2.COLOR_BGR2RGB)130 image = QImage(shrink.data,131 shrink.shape[1],132 shrink.shape[0],133 shrink.shape[1] * 3,134 QImage.Format_RGB888)135 self.ADD_frame_label.setPixmap(QPixmap().fromImage(image))136 self.img = img137 self.openAll()138 # å®æ¶äººè¸çå¬äºä»¶139 def getCameraFace(self):140 # æå¼äººè¸è¯å«æ¡141 cap = cv2.VideoCapture(2)142 faceLocation = None143 img = None144 flag = False145 while (1):146 if cv2.waitKey(1) & 0xFF == ord('q'):147 break148 # get a frame149 ret, frame = cap.read()150 # 转ç 151 img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)152 faceLocation = getFaceLocations(img)153 # show a frame154 if len(faceLocation) == 0:155 cv2.imshow("show", frame)156 continue157 else:158 # 设置å¾ç159 self.frame = frame160 # éå人è¸ä½ç½®ä¿¡æ¯161 for top, right, bottom, left in faceLocation:162 # 对人è¸ç»æ¡163 cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2)164 cv2.imshow("show", frame)165 # è·åç¼ç 166 self.faceEncode = getFaceEncode(img,faceLocation)[0]167 time.sleep(2)168 flag = True169 break170 cap.release()171 cv2.destroyAllWindows()172 # æ¯å¦è·å173 if flag == False:174 return False175 # å¾ç转æ¢176 shrink = cv2.resize(self.frame, self.labelSize, interpolation=cv2.INTER_AREA)177 # æ´æ¹ç¼ç 178 shrink = cv2.cvtColor(shrink, cv2.COLOR_BGR2RGB)179 image = QImage(shrink.data,180 shrink.shape[1],181 shrink.shape[0],182 shrink.shape[1] * 3,183 QImage.Format_RGB888)184 self.ADD_frame_label.setPixmap(QPixmap().fromImage(image))185 self.img = img186 # æ¶è·å°äººè¸å¤ææ¯å¦åå¨187 # è·å人è¸åéåº188 # å°äººè¸åå°label189 # æå¼è¾å
¥é项190 self.openAll()191 def OK_btn(self):192 # å¤æ人è¸æ¯å¦åå¨193 faceid = getFaceOf(self.faceEncode,self.channelDict["faceLib"])194 if faceid != 0:195 QMessageBox.warning(self, 'è¦å', '该人è¸å·²åå¨ï¼', QMessageBox.Yes)196 return197 elif self.ADD_name_edit.text() == "":198 QMessageBox.warning(self, 'è¦å', '请è¾å
¥ä¿¡æ¯ï¼', QMessageBox.Yes)199 elif faceid == 0:200 PDI = person_dao_impl.PersonDaoImpl()201 # è·å¾personClassçID202 personClassID = getKeyByValue(self.channelDict["personClass"],self.ADD_comboBox.currentText())203 # å
æ·»å 人å204 PDI.addPerson(Person(self.faceEncode, self.ADD_name_edit.text(), int(personClassID), "null"))205 # è·å¾æåä¸æ¡è®°å½206 personID = int(self.PDI.getLastPersonID())207 # ä¿åå¾ç ç¶åè·å¾å¾çè·¯å¾208 file_path = saveRGB2JPG(self.img,"person/{0}_{1}".format(personID,getCurDateTime()))209 # åå¡«å
人åå¾çä¿¡æ¯210 PDI.setPersonPicPath(personID,file_path)211 # å®æ¶æ´æ°äººè¸åº212 self.channelDict["DataGetThreadContent"].append("updateFaceLib")213 self.channelDict["DataGetThreadEvent"].set()214 QMessageBox.information(self, 'æå', '注åæåï¼', QMessageBox.Yes)215 self.closeAll()216 def closeAll(self):217 self.ADD_frame_label.setText("请ç¹å»ä¸æ¹æé®è·å人è¸")218 self.ADD_name_edit.setText("")219 self.ADD_comboBox.setCurrentIndex(0)220 self.ADD_name_edit.setEnabled(False)221 self.ADD_comboBox.setEnabled(False)222 self.ADD_OK.setEnabled(False)223 self.frame = None224 self.faceEncode = None225 self.img = None226 def openAll(self):227 self.ADD_name_edit.setEnabled(True)228 self.ADD_comboBox.setEnabled(True)229 self.ADD_OK.setEnabled(True)230if __name__ == '__main__':231 QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)232 # æ¯ä¸ä¸ªpyqtç¨åºä¸é½éè¦æä¸ä¸ªQApplication对象ï¼sys.argvæ¯ä¸ä¸ªå½ä»¤è¡åæ°å表233 app = QApplication(sys.argv)234 # å®ä¾åçªå£235 form = AddPersonForm()236 # å°çªå£æ§ä»¶æ¾ç¤ºå¨å±å¹ä¸237 form.show()238 # è¿å
¥ç¨åºç主循ç¯ï¼éå°éåºæ
åµï¼ç»æ¢ç¨åº...
test_tracker.py
Source:test_tracker.py
...16 tracker._track("FakeTestClass")17 self.assertEqual(tracker._test_cases.get("FakeTestClass"), [])18 def test_adds_ok(self):19 tracker = Tracker()20 tracker.add_ok("FakeTestCase", "a description")21 line = tracker._test_cases["FakeTestCase"][0]22 self.assertTrue(line.ok)23 self.assertEqual(line.description, "a description")24 def test_adds_not_ok(self):25 tracker = Tracker()26 tracker.add_not_ok("FakeTestCase", "a description")27 line = tracker._test_cases["FakeTestCase"][0]28 self.assertFalse(line.ok)29 self.assertEqual(line.description, "a description")30 def test_adds_skip(self):31 tracker = Tracker()32 tracker.add_skip("FakeTestCase", "a description", "a reason")33 line = tracker._test_cases["FakeTestCase"][0]34 self.assertTrue(line.ok)35 self.assertEqual(line.description, "a description")36 self.assertEqual(line.directive.text, "SKIP a reason")37 def test_generates_tap_reports_in_new_outdir(self):38 tempdir = tempfile.mkdtemp()39 outdir = os.path.join(tempdir, "non", "existent", "path")40 tracker = Tracker(outdir=outdir)41 tracker.add_ok("FakeTestCase", "I should be in the specified dir.")42 tracker.generate_tap_reports()43 tap_file = os.path.join(outdir, "FakeTestCase.tap")44 self.assertTrue(os.path.exists(tap_file))45 def test_generates_tap_reports_in_existing_outdir(self):46 outdir = tempfile.mkdtemp()47 tracker = Tracker(outdir=outdir)48 tracker.add_ok("FakeTestCase", "I should be in the specified dir.")49 tracker.generate_tap_reports()50 tap_file = os.path.join(outdir, "FakeTestCase.tap")51 self.assertTrue(os.path.exists(tap_file))52 def test_results_not_combined_by_default(self):53 tracker = Tracker()54 self.assertFalse(tracker.combined)55 def test_individual_report_has_no_plan_when_combined(self):56 outdir = tempfile.mkdtemp()57 tracker = Tracker(outdir=outdir, combined=True)58 tracker.add_ok("FakeTestCase", "Look ma, no plan!")59 out_file = StringIO()60 tracker.generate_tap_report(61 "FakeTestCase", tracker._test_cases["FakeTestCase"], out_file62 )63 report = out_file.getvalue()64 self.assertTrue("Look ma" in report)65 self.assertFalse("1.." in report)66 @mock.patch("tap.tracker.ENABLE_VERSION_13", False)67 def test_combined_results_in_one_file_tap_version_12(self):68 outdir = tempfile.mkdtemp()69 tracker = Tracker(outdir=outdir, combined=True)70 tracker.add_ok("FakeTestCase", "YESSS!")71 tracker.add_ok("DifferentFakeTestCase", "GOAAL!")72 tracker.generate_tap_reports()73 self.assertFalse(os.path.exists(os.path.join(outdir, "FakeTestCase.tap")))74 self.assertFalse(75 os.path.exists(os.path.join(outdir, "DifferentFakeTestCase.tap"))76 )77 with open(os.path.join(outdir, "testresults.tap"), "r") as f:78 report = f.read()79 expected = inspect.cleandoc(80 """{header_1}81 ok 1 YESSS!82 {header_2}83 ok 2 GOAAL!84 1..285 """.format(86 header_1=self._make_header("FakeTestCase"),87 header_2=self._make_header("DifferentFakeTestCase"),88 )89 )90 self.assertEqual(report.strip(), expected)91 @mock.patch("tap.tracker.ENABLE_VERSION_13", True)92 def test_combined_results_in_one_file_tap_version_13(self):93 outdir = tempfile.mkdtemp()94 tracker = Tracker(outdir=outdir, combined=True)95 tracker.add_ok("FakeTestCase", "YESSS!")96 tracker.add_ok("DifferentFakeTestCase", "GOAAL!")97 tracker.generate_tap_reports()98 self.assertFalse(os.path.exists(os.path.join(outdir, "FakeTestCase.tap")))99 self.assertFalse(100 os.path.exists(os.path.join(outdir, "DifferentFakeTestCase.tap"))101 )102 with open(os.path.join(outdir, "testresults.tap"), "r") as f:103 report = f.read()104 expected = inspect.cleandoc(105 """106 TAP version 13107 {header_1}108 ok 1 YESSS!109 {header_2}110 ok 2 GOAAL!111 1..2112 """.format(113 header_1=self._make_header("FakeTestCase"),114 header_2=self._make_header("DifferentFakeTestCase"),115 )116 )117 self.assertEqual(report.strip(), expected)118 def test_tracker_does_not_stream_by_default(self):119 tracker = Tracker()120 self.assertFalse(tracker.streaming)121 def test_tracker_has_stream(self):122 tracker = Tracker()123 self.assertTrue(tracker.stream is None)124 @mock.patch("tap.tracker.ENABLE_VERSION_13", False)125 def test_add_ok_writes_to_stream_while_streaming(self):126 stream = StringIO()127 tracker = Tracker(streaming=True, stream=stream)128 tracker.add_ok("FakeTestCase", "YESSS!")129 tracker.add_ok("AnotherTestCase", "Sure.")130 expected = inspect.cleandoc(131 """{header_1}132 ok 1 YESSS!133 {header_2}134 ok 2 Sure.135 """.format(136 header_1=self._make_header("FakeTestCase"),137 header_2=self._make_header("AnotherTestCase"),138 )139 )140 self.assertEqual(stream.getvalue().strip(), expected)141 @mock.patch("tap.tracker.ENABLE_VERSION_13", False)142 def test_add_not_ok_writes_to_stream_while_streaming(self):143 stream = StringIO()144 tracker = Tracker(streaming=True, stream=stream)145 tracker.add_not_ok("FakeTestCase", "YESSS!")146 expected = inspect.cleandoc(147 """{header}148 not ok 1 YESSS!149 """.format(150 header=self._make_header("FakeTestCase")151 )152 )153 self.assertEqual(stream.getvalue().strip(), expected)154 @mock.patch("tap.tracker.ENABLE_VERSION_13", False)155 def test_add_skip_writes_to_stream_while_streaming(self):156 stream = StringIO()157 tracker = Tracker(streaming=True, stream=stream)158 tracker.add_skip("FakeTestCase", "YESSS!", "a reason")159 expected = inspect.cleandoc(160 """{header}161 ok 1 YESSS! # SKIP a reason162 """.format(163 header=self._make_header("FakeTestCase")164 )165 )166 self.assertEqual(stream.getvalue().strip(), expected)167 def test_streaming_does_not_write_files(self):168 outdir = tempfile.mkdtemp()169 stream = StringIO()170 tracker = Tracker(outdir=outdir, streaming=True, stream=stream)171 tracker.add_ok("FakeTestCase", "YESSS!")172 tracker.generate_tap_reports()173 self.assertFalse(os.path.exists(os.path.join(outdir, "FakeTestCase.tap")))174 @mock.patch("tap.tracker.ENABLE_VERSION_13", False)175 def test_streaming_writes_plan(self):176 stream = StringIO()177 tracker = Tracker(streaming=True, stream=stream)178 tracker.combined_line_number = 42179 tracker.generate_tap_reports()180 self.assertEqual(stream.getvalue(), "1..42\n")181 @mock.patch("tap.tracker.ENABLE_VERSION_13", False)182 def test_write_plan_first_streaming(self):183 outdir = tempfile.mkdtemp()184 stream = StringIO()185 tracker = Tracker(outdir=outdir, streaming=True, stream=stream)186 tracker.set_plan(123)187 tracker.add_ok("FakeTestCase", "YESSS!")188 tracker.generate_tap_reports()189 self.assertEqual(190 stream.getvalue(),191 "1..123\n{header}\nok 1 YESSS!\n".format(192 header=self._make_header("FakeTestCase")193 ),194 )195 self.assertFalse(os.path.exists(os.path.join(outdir, "FakeTestCase.tap")))196 @mock.patch("tap.tracker.ENABLE_VERSION_13", False)197 def test_write_plan_immediate_streaming(self):198 stream = StringIO()199 Tracker(streaming=True, stream=stream, plan=123)200 self.assertEqual(stream.getvalue(), "1..123\n")201 @mock.patch("tap.tracker.ENABLE_VERSION_13", False)...
new_file.py
Source:new_file.py
1#!/usr/bin/python2# -*- coding: utf-8 -*-3import os4import shutil5import sys6INTERVAL_TIME = [1.0, 5.0]7ALL_TEST_CASE = [8 ["numb_key", "one_by_one", "timeout", "All", "TV", INTERVAL_TIME[1]],9 ["numb_key", "one_by_one", "timeout", "All", "Radio", INTERVAL_TIME[1]],10 ["numb_key", "one_by_one", "add_ok", "All", "TV", INTERVAL_TIME[1]],11 ["numb_key", "random", "timeout", "All", "TV", INTERVAL_TIME[1]],12 ["screen", "up", "timeout", "All", "TV", INTERVAL_TIME[1]],13 ["screen", "down", "timeout", "All", "TV", INTERVAL_TIME[1]],14 ["screen", "random", "timeout", "All", "TV", INTERVAL_TIME[1]],15 ["screen", "up", "continuous", "All", "TV", INTERVAL_TIME[0]],16 ["ch_list", "up", "add_ok", "All", "TV", INTERVAL_TIME[1]],17 ["ch_list", "down", "add_ok", "All", "TV", INTERVAL_TIME[1]],18 ["ch_list", "random_up", "add_ok", "All", "TV", INTERVAL_TIME[1]],19 ["ch_list", "random_down", "add_ok", "All", "TV", INTERVAL_TIME[1]],20 ["ch_list", "page_up", "add_ok", "All", "TV", INTERVAL_TIME[1]],21 ["ch_list", "page_down", "add_ok", "All", "TV", INTERVAL_TIME[1]],22 ["ch_list", "left", "group", "All", "TV", INTERVAL_TIME[1]],23 ["ch_list", "right", "group", "All", "TV", INTERVAL_TIME[1]],24 ["ch_list", "left_group_random_down", "add_ok", "All", "TV", INTERVAL_TIME[1]],25 ["ch_list", "right_group_random_down", "add_ok", "All", "TV", INTERVAL_TIME[1]],26 ["epg", "up", "timeout", "All", "TV", INTERVAL_TIME[1]],27 ["epg", "down", "timeout", "All", "TV", INTERVAL_TIME[1]],28 ["epg", "page_up", "timeout", "All", "TV", INTERVAL_TIME[1]],29 ["epg", "page_down", "timeout", "All", "TV", INTERVAL_TIME[1]],30 ["epg", "random", "timeout", "All", "TV", INTERVAL_TIME[1]],31 ["epg", "up", "continuous", "All", "TV", INTERVAL_TIME[0]],32 ["ch_edit", "up", "add_ok", "All", "TV", INTERVAL_TIME[1]],33 ["ch_edit", "down", "add_ok", "All", "TV", INTERVAL_TIME[1]],34 ["ch_edit", "random_up", "add_ok", "All", "TV", INTERVAL_TIME[1]],35 ["ch_edit", "random_down", "add_ok", "All", "TV", INTERVAL_TIME[1]],36 ["ch_edit", "page_up", "add_ok", "All", "TV", INTERVAL_TIME[1]],37 ["ch_edit", "page_down", "add_ok", "All", "TV", INTERVAL_TIME[1]],38 ["ch_edit", "left", "group", "All", "TV", INTERVAL_TIME[1]],39 ["ch_edit", "right", "group", "All", "TV", INTERVAL_TIME[1]],40 ["ch_edit", "left_group_random_down", "add_ok", "All", "TV", INTERVAL_TIME[1]],41 ["ch_edit", "right_group_random_down", "add_ok", "All", "TV", INTERVAL_TIME[1]],42 ["tv_radio", "free_tv", "free_radio", "All", "TV", INTERVAL_TIME[1]],43 ["tv_radio", "free_tv", "scr_radio", "All", "TV", INTERVAL_TIME[1]],44 ["tv_radio", "free_tv", "lock_radio", "All", "TV", INTERVAL_TIME[1]],45 ["tv_radio", "scr_tv", "free_radio", "All", "TV", INTERVAL_TIME[1]],46 ["tv_radio", "scr_tv", "scr_radio", "All", "TV", INTERVAL_TIME[1]],47 ["tv_radio", "scr_tv", "lock_radio", "All", "TV", INTERVAL_TIME[1]],48 ["tv_radio", "lock_tv", "free_radio", "All", "TV", INTERVAL_TIME[1]],49 ["tv_radio", "lock_tv", "scr_radio", "All", "TV", INTERVAL_TIME[1]],50 ["tv_radio", "lock_tv", "lock_radio", "All", "TV", INTERVAL_TIME[1]],51 ["recall", "free_tv", "free_tv", "All", "TV", INTERVAL_TIME[1]],52 ["recall", "free_tv", "scr_tv", "All", "TV", INTERVAL_TIME[1]],53 ["recall", "free_tv", "lock_tv", "All", "TV", INTERVAL_TIME[1]],54 ["recall", "scr_tv", "scr_tv", "All", "TV", INTERVAL_TIME[1]],55 ["recall", "scr_tv", "lock_tv", "All", "TV", INTERVAL_TIME[1]],56 ["recall", "lock_tv", "lock_tv", "All", "TV", INTERVAL_TIME[1]],57 ["recall", "free_radio", "free_radio", "All", "Radio", INTERVAL_TIME[1]],58 ["recall", "free_radio", "scr_radio", "All", "Radio", INTERVAL_TIME[1]],59 ["recall", "free_radio", "lock_radio", "All", "Radio", INTERVAL_TIME[1]],60 ["recall", "scr_radio", "scr_radio", "All", "Radio", INTERVAL_TIME[1]],61 ["recall", "scr_radio", "lock_radio", "All", "Radio", INTERVAL_TIME[1]],62 ["recall", "lock_radio", "lock_radio", "All", "Radio", INTERVAL_TIME[1]],63 ["recall", "free_tv", "free_radio", "All", "TV", INTERVAL_TIME[1]],64 ["recall", "free_tv", "scr_radio", "All", "TV", INTERVAL_TIME[1]],65 ["recall", "free_tv", "lock_radio", "All", "TV", INTERVAL_TIME[1]],66 ["recall", "scr_tv", "free_radio", "All", "TV", INTERVAL_TIME[1]],67 ["recall", "scr_tv", "scr_radio", "All", "TV", INTERVAL_TIME[1]],68 ["recall", "scr_tv", "lock_radio", "All", "TV", INTERVAL_TIME[1]],69 ["recall", "lock_tv", "free_radio", "All", "TV", INTERVAL_TIME[1]],70 ["recall", "lock_tv", "scr_radio", "All", "TV", INTERVAL_TIME[1]],71 ["recall", "lock_tv", "lock_radio", "All", "TV", INTERVAL_TIME[1]],72 ["recall", "same_tp_tv", "same_tp_tv", "All", "TV", INTERVAL_TIME[1]],73 ["recall", "diff_tp_tv", "diff_tp_tv", "All", "TV", INTERVAL_TIME[1]],74 ["recall", "same_codec_tv", "same_codec_tv", "All", "TV", INTERVAL_TIME[1]],75 ["recall", "diff_codec_tv", "diff_codec_tv", "All", "TV", INTERVAL_TIME[1]],76 ["recall", "hd_tv", "hd_tv", "All", "TV", INTERVAL_TIME[1]],77 ["recall", "sd_tv", "sd_tv", "All", "TV", INTERVAL_TIME[1]],78 ["recall", "hd_sd_tv", "hd_sd_tv", "All", "TV", INTERVAL_TIME[1]],79]80choice_switch_mode = 181case_loop_time = 182parent_path = os.path.dirname(os.getcwd())83main_file_path = os.path.join(parent_path,"main_program","main.py")84test_file_path = os.path.join(os.getcwd(),"main.py")85for i in range(case_loop_time):86 shutil.copy(main_file_path, os.getcwd())87 os.system("python %s %d" % (test_file_path, choice_switch_mode))...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!