class TestGeneral(unittest.TestCase): def setUp(self): #Run before each test self.FSW = VSA() try: self.FSW.jav_Open(host,prnt=0) #self.FSW.jav_Reset() self.FSW.jav_ClrErr() self.FSW.dLastErr = "" except: self.assertTrue(1) #FAIL def tearDown(self): #Run after each test self.FSW.jav_Close() ############################################################################### ### <Test> ############################################################################### def test_FSW_Connect(self): self.FSW.jav_IDN(prnt=0) self.assertEqual(self.FSW.Make,"Rohde&Schwarz") def test_FSW_CommonSettings(self): self.FSW.Init_ACLR() self.FSW.Set_Freq(1e6) self.FSW.Set_RefLevel(10) self.FSW.Set_ResBW(1e6) self.FSW.Set_VidBW(1e6) self.FSW.Set_Span(100e6) self.FSW.Get_AttnMech() self.FSW.Get_RefLevel() self.assertEqual(self.FSW.jav_Error()[0],'0') def test_FSW_Marker(self): self.FSW.Set_Mkr_Peak() asdf = self.FSW.Get_Mkr_Freq() self.assertEqual(self.FSW.jav_Error()[0],'0') def test_FSW_ACLR(self): self.FSW.Get_ACLR() #var = input("Please enter something: ") self.assertEqual(self.FSW.jav_Error()[0],'0')
#FSW.Set_ResBW(500e3) #FSW.Set_DisplayUpdate("OFF") FSW.Set_SweepCont(0) FSW.Set_SweepTime(MeasTim) FSW.Set_YIG('ON') FSW.Set_InitImm() if 1: FSW.Set_Trig1_Source('Ext') ########################################################## ### Measure Time ########################################################## #sDate = datetime.now().strftime("%y%m%d-%H:%M:%S.%f") #Date String OFile.write('ACLR,CapTime,Iter,CmdTime') sumTime = 0 for i in range(20): tick = datetime.now() FSW.Set_InitImm() aclr = FSW.Get_ACLR() d = datetime.now() - tick sumTime += d.microseconds OutStr = '%s,%.6f,%d,%3d.%06d'%(aclr,MeasTim,i,d.seconds,d.microseconds) OFile.write (OutStr) print('%f'%(sumTime/20)) ########################################################## ### Cleanup Automation ########################################################## FSW.jav_Close()