How to use loadlines method in Testify

Best Python code snippet using Testify_python

runner.py

Source:runner.py Github

copy

Full Screen

1#!/usr/bin/env python2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo3# Copyright (C) 2008-2021 German Aerospace Center (DLR) and others.4# This program and the accompanying materials are made available under the5# terms of the Eclipse Public License 2.0 which is available at6# https://www.eclipse.org/legal/epl-2.0/7# This Source Code may also be made available under the following Secondary8# Licenses when the conditions for such availability set forth in the Eclipse9# Public License 2.0 are satisfied: GNU General Public License, version 210# or later which is available at11# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html12# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later13# @file runner.py14# @author Michael Behrisch15# @author Jakob Erdmann16# @date 2009-11-0417from __future__ import absolute_import18from __future__ import print_function19import os20import subprocess21import sys22sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools"))23import sumolib # noqa24redirectStdout = False25redirectStderr = False26compare = []27if '--compare' in sys.argv:28 cmpIdx = sys.argv.index('--compare')29 for c in sys.argv[cmpIdx + 1].split(","):30 entry = c.split(":") + [0, 0]31 compare.append((entry[0], int(entry[1]), int(entry[2])))32 if entry[0] == "stdout":33 redirectStdout = True34 if entry[0] == "stderr":35 redirectStderr = True36 del sys.argv[cmpIdx:cmpIdx + 2]37idx = sys.argv.index(":")38saveParams = sys.argv[1:idx]39loadParams = sys.argv[idx + 1:]40if '--mesosim' in loadParams:41 saveParams.append('--mesosim')42# need to add runner.py again in options.complex.meso to ensure it is the43# last entry44saveParams = [p for p in saveParams if 'runner.py' not in p]45loadParams = [p for p in loadParams if 'runner.py' not in p]46# print("save:", saveParams)47# print("load:", loadParams)48sumoBinary = sumolib.checkBinary("sumo")49saveOut = open("save.out", "w") if redirectStdout else sys.stdout50loadOut = open("load.out", "w") if redirectStdout else sys.stdout51saveErr = open("save.err", "w") if redirectStderr else sys.stderr52loadErr = open("load.err", "w") if redirectStderr else sys.stderr53subprocess.call([sumoBinary] + saveParams,54 shell=(os.name == "nt"), stdout=saveOut, stderr=saveErr)55subprocess.call([sumoBinary] + loadParams,56 shell=(os.name == "nt"), stdout=loadOut, stderr=loadErr)57if compare:58 for f in (saveOut, loadOut, saveErr, loadErr):59 f.flush()60 for fileType, offsetSave, offsetLoad in compare:61 if fileType == "stdout":62 sys.stdout.write(open(saveOut.name).read())63 saveLines = open(saveOut.name).readlines()[offsetSave:]64 loadLines = open(loadOut.name).readlines()[offsetLoad:]65 sys.stdout.write("".join(sumolib.fpdiff.diff(saveLines, loadLines, 0.01)))66 elif fileType == "stderr":67 sys.stderr.write(open(saveErr.name).read())68 saveLines = open(saveErr.name).readlines()[offsetSave:]69 loadLines = open(loadErr.name).readlines()[offsetLoad:]70 sys.stderr.write("".join(sumolib.fpdiff.diff(saveLines, loadLines, 0.01)))71 else:72 saveLines = open(fileType + ".xml").readlines()73 saveLines = saveLines[saveLines.index("-->\n") + offsetSave:]74 loadLines = open(fileType + "2.xml").readlines()75 loadLines = loadLines[loadLines.index("-->\n") + offsetLoad:]...

Full Screen

Full Screen

Grapher.py

Source:Grapher.py Github

copy

Full Screen

1import pyqtgraph as pg2from dataTools.MeasurementData import *3import Config4class Grapher():5 """ A class for plotting collected data into the graph are of the UI.6 This class allows for graphing data as its collected, graphing old data,7 and clearing the graph. """8 def __init__(self, graphHandle):9 """ Creates a new grapher object for visualizing collected data.10 Parameters:11 graphHandle: The pyqtplot widget used in the UI """12 self.graph = graphHandle13 self.colorindex = 014 self.loadLines = []15 self.stepLines = []16 self.phaseLines = []17 self.loadStepLines = []18 19 return20 21 def getPen(self):22 color = pg.intColor(self.colorindex, hues=Config.GRAPH_COLORS, values=1, maxValue=255, minValue=150, maxHue=360, minHue=0, sat=255, alpha=255)23 self.colorindex += 124 return pg.mkPen(color, width = Config.GRAPH_LINE_WIDTH)25 def setupTimeSeries(self):26 27 self.view = 028 # set up the graph area29 self.graph.setBackground('w')30 self.graph.setLabel('left', 'Displacement (x100)', units ='steps')31 self.graph.setLabel('right', 'Force', units ='N')32 self.graph.setLabel('bottom', 'Sample number')33 34 if self.loadLines != [] and self.stepLines != [] and self.loadStepLines != []:35 for i in self.loadLines:36 i.show()37 for i in self.stepLines:38 i.show()39 for i in self.loadStepLines:40 i.hide()41 return42 def setupLoadDisplacementGraph(self):43 44 self.view = 145 # set up the graph area46 self.graph.setBackground('w')47 self.graph.setLabel('left', 'Force', units ='N')48 self.graph.setLabel('right', '', units ='')49 self.graph.setLabel('bottom', 'Displacement (x100)', units ='steps')50 if self.loadLines != [] and self.stepLines != [] and self.loadStepLines != []:51 for i in self.loadLines:52 i.hide()53 for i in self.stepLines:54 i.hide()55 for i in self.loadStepLines:56 i.show()57 return58 def cycleViews(self):59 # toggle to time series60 if self.view == 0:61 # update current view type62 self.setupLoadDisplacementGraph()63 # toggle to load as function of displacement64 elif self.view == 1:65 # update current view type66 self.setupTimeSeries()67 # make sure the data is in range68 self.graph.getPlotItem().enableAutoRange()69 return70 def clear(self):71 """ Clears the collected data and the graph area. """72 for i in self.loadLines:73 i.clear()74 for i in self.stepLines:75 i.clear()76 for i in self.loadStepLines:77 i.clear() 78 self.loadLines = []79 self.stepLines = []80 self.loadStepLines = []81 self.graph.getPlotItem().enableAutoRange()82 self.colorindex = 0...

Full Screen

Full Screen

load_lines.py

Source:load_lines.py Github

copy

Full Screen

1from django.core.management.base import BaseCommand2from rutedata.load_xml.LoadLines import LoadLines3class Command(BaseCommand):4 help = 'Import lines from XML'5 def handle(self, *args, **options):6 # Lines7 load = LoadLines()...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Testify automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful