def run(self): if GET_ENABLE: get = threading.Thread(target=self.schedule_get) #get = Process(target=self.schedule_get) get.start() if TEST_ENABLE: test = threading.Thread(target=self.schedule_test) #test = Process(target=self.schedule_test) test.start()
def start_test(): while True: text=main() print(text) print('teeest') if text is not None: text= text.lower() print(text) if 'hello' in text: print("thre") test.start() else: pass time.sleep(5)
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Layer property access') import easyvideo.screen scr = easyvideo.screen.Screen() try: test.ok('Background layer size: %s' % scr.background.area) except Exception, e: test.failed('Cannot get layer size (%s)' % e)
def main(): mandrelSetup = False a = 1 while a: # here the user can select if the user wants # to control the speed using braider or mandrel motorType = input( "What type of Motor do you want to run? Braider/ Mandrel(B/M/Quit): " ) #If they chose to control the Braider, you can set rotational speed and its direction while 1: if motorType in ["B", "b"]: rpm = input( "\nWhat speed do you want to move the braid head at?(Type Quit to end): " ) if rpm in ["Quit", "Q", "q"]: #StepperQuit print("Quitting") braider.dcStop() mandrel.stop() sys.exit(0) else: if mandrelSetup == False: mandrel.start() braider.dcStart() braider.setDCRPM(float(rpm)) print(float(equation(rpm, "B"))) mandrel.set_speed(float(equation(rpm, "B"))) # If they choose Mandrel, one can select the linear velocity of mandrel elif motorType in ["M", "m"]: rpm = input( "\nWhat speed do you want to move the mandrel at?(Type Quit to end): " ) if rpm in ["Quit", "Q", "q"]: #StepperQuit print("Quitting") braider.dcStop() mandrel.stop() sys.exit(0) else: print("Mandrel Running") if mandrelSetup == False: mandrel.start() braider.dcStart() mandrel.set_speed(float(rpm)) braider.setDCRPM(float(equation(rpm, "M"))) print(int(equation(rpm, "M"))) elif motorType in ["Q", "q", "Quit"]: #StepperQuit print("Quitting") braider.dcStop() mandrel.stop() sys.exit(0) else: print( "Wrong Input please input something from the given options.\n" ) print("Quitting") braider.dcStop() mandrel.stop() sys.exit(0)
title, header, footer = getHeaderFooter("help") return render.help(title, header, footer) class about: def GET(self, args): userlog.addLog(web.ctx.ip, self.__class__.__name__ + " " + get_cur_fun_name(), web.ctx.path + ":" + web.ctx.query + ":" + web.ctx.protocol) title, header, footer = getHeaderFooter("about") return render.about(title, header, footer) if __name__ == "__main__": #logging if not os.path.isdir(logsDir): os.mkdir(logsDir) logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', filename='logs/logs.log', filemode='a+') #main thread testThread = test.start() mainThread = threading.Thread(target=runweb) mainThread.start() mainThread.join() testThread.join() pass
# This is the expected sequence of statuses for a successful calibration successful_calibration_status_list = [ rs.calibration_status.triggered, rs.calibration_status.special_frame, rs.calibration_status.started, rs.calibration_status.successful ] # Possible statuses that are irrelevant for this test irrelevant_statuses = [ rs.calibration_status.retry, rs.calibration_status.scene_invalid, rs.calibration_status.bad_result ] ############################################################################################# # Test #1 test.start("Depth sensor is off, should get an error") try: d2r.trigger_device_calibration(rs.calibration_type.manual_depth_to_rgb) ac.wait_for_calibration() except Exception as e: test.check_exception(e, RuntimeError, "not streaming") else: test.unexpected_exception( ) # No error Occurred, should have received a RuntimeError test.check(ac.status_list_is_empty() ) # No status changes are expected, list should remain empty test.finish() ############################################################################################# # Test #2 test.start("Color sensor is off, calibration should succeed")
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Screen update') import easyvideo.screen scr = easyvideo.screen.Screen() try: scr.update() except Exception, e: test.failed('Cannot perform update() (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Change screen caption') import easyvideo.screen scr = easyvideo.screen.Screen() try: scr.set_caption('Another caption') except Exception, e: test.failed('Cannot change screen caption (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Add vertical-flipped animation to container') import easyvideo.animation animations = easyvideo.animation.Animations() frames = easyvideo.animation.FrameSet('data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animations.add('animation1', frames.vertical_flip.animation) except Exception, e: test.failed('Cannot add flipped animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Get screen properties') import easyvideo.screen scr = easyvideo.screen.Screen() try: test.ok('Screen resolution: %sx%s' % scr.size) except Exception, e: test.failed('Cannot get screen size (%s)' % e)
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Screen layers access') import easyvideo.screen scr = easyvideo.screen.Screen() try: test.ok('Background layer: %s' % type(scr.background.layer)) except Exception, e: test.failed('Cannot access to background layer (%s)' % e)
import pyrealsense2 as rs, test, ac devices = test.find_devices_by_product_line_or_exit(rs.product_line.L500) depth_sensor = devices[0].first_depth_sensor() debug_sensor = rs.debug_stream_sensor(depth_sensor) debug_profiles = debug_sensor.get_debug_stream_profiles() ############################################################################################# test.start("FG isn't exposed by get_stream_profiles") matches = list(p for p in depth_sensor.profiles if p.format() == rs.format.fg) test.check(len(matches) == 0) test.finish() ############################################################################################# test.start("FG exposed by debug_stream_sensor") matches = list(p for p in debug_profiles if p.format() == rs.format.fg) test.check(len(matches) > 0) test.finish() ############################################################################################# test.start("streaming FG 800x600") dp = next( p for p in debug_profiles if p.fps() == 30 and p.stream_type() == rs.stream.depth and p.format() == rs.format.fg and p.as_video_stream_profile().width() == 800 and p.as_video_stream_profile().height() == 600) depth_sensor.open(dp)
help='Number of GPUs') parser.add_argument('-trials', metavar='trials', type=int, help="Number of warmup runs") args = parser.parse_args() if __name__ == '__main__': m = args.m n_local = 10000**2 N = m * n_local t = time.time() import numpy as np import test as kokkos kokkos.start(m) t = time.time() - t print("Initilize time: ", t, flush=True) t = time.time() array = np.arange(1, N+1, dtype='float64') result = np.zeros(m, dtype='float64') t = time.time() - t print("Initilize array time: ", t, flush=True) def reduction(array, i): t = time.perf_counter() p = kokkos.dev_copy(array, (int)(np.sqrt(len(array))), i) t = time.perf_counter() - t print("Copy time: ", t)
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Image load') import easyvideo.image try: img = easyvideo.image.load('data/sample_image.jpg') except Exception, e: test.failed('Cannot load image (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create animation') import easyvideo.animation frames = easyvideo.animation.FrameSet('data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animation = frames.animation except Exception, e: test.failed('Cannot create animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Add animations to container') import easyvideo.animation animations = easyvideo.animation.Animations() frames = easyvideo.animation.FrameSet('data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animations.add('animation1', frames.animation) except Exception, e: test.failed('Cannot add animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create frameset') import easyvideo.animation try: frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') except Exception, e: test.failed('Cannot create frame set (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Add horizontal-flipped animation to container') import easyvideo.animation animations = easyvideo.animation.Animations() frames = easyvideo.animation.FrameSet('data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animations.add('animation1', frames.horizontal_flip.animation) except Exception, e: test.failed('Cannot add flipped animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create animation container') import easyvideo.animation try: animations = easyvideo.animation.Animations() except Exception, e: test.failed('Cannot create animation container (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create animation loop') import easyvideo.animation frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animation_loop = frames.animation_loop except Exception, e: test.failed('Cannot create animation loop (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Add vertical-flipped animation to container') import easyvideo.animation animations = easyvideo.animation.Animations() frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animations.add('animation1', frames.vertical_flip.animation) except Exception, e: test.failed('Cannot add flipped animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Import') try: import easyvideo.screen except ImportError: test.failed('Cannot import library!') test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create animation loop') import easyvideo.animation frames = easyvideo.animation.FrameSet('data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animation_loop = frames.animation_loop except Exception, e: test.failed('Cannot create animation loop (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Display init') import easyvideo.screen try: scr = easyvideo.screen.Screen() except Exception, e: test.failed('Cannot init display (%s)' % e) test.ok()
import logging.config from logging_conf import LOGGING_CONFIG from test import start if __name__ == '__main__': logging.config.dictConfig(LOGGING_CONFIG) start()
parser.add_argument('-t', '--test', type=str, required=False, metavar='', help='the tests are run. To use it write "start"') args = parser.parse_args() if (args.directory): path = args.directory print(path) if (args.output): output = args.output print(output) if (args.test): start_test = args.test if (start_test == 'start'): #print("test") test.start() midi = midi_manipulation.midi_manipulation() ma = main() songs = ma.get_files(path, midi) # midi.mass_check = set(midi.mass_check) if len(songs) == 0: print('error: the directory is empty') else: # print(songs) if (not os.path.isdir("generated")): os.mkdir("generated") # print("11111111111111111111111111111111111111111111111111111112")
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create animation') import easyvideo.animation frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animation = frames.animation except Exception, e: test.failed('Cannot create animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Add animations to container') import easyvideo.animation animations = easyvideo.animation.Animations() frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animations.add('animation1', frames.animation) except Exception, e: test.failed('Cannot add animation (%s)' % e) test.ok()
print(dropped_frames, "depth frame(s) starting from frame", previous_depth_frame_number + 1, "were dropped") test.fail() if dropped_frames < 0: print("Depth frames repeated or out of order. Got frame", frame_number, "after frame", previous_depth_frame_number) test.fail() previous_depth_frame_number = frame_number depth_sensor.open( dp ) depth_sensor.start( depth_frame_call_back ) color_sensor.open( cp ) color_sensor.start( color_frame_call_back ) ############################################################################################# # Test #1 test.start("Checking for frame drops in", n_cal, "calibrations") for i in range(n_cal): try: dcs.reset_calibration() ccs.reset_calibration() d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb ) ac.wait_for_calibration() except: test.unexpected_exception() test.finish() ############################################################################################# # Test #2 test.start("Checking for frame drops in a failed calibration") ac.reset_status_list() try:
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Image draw') import easyvideo.screen import easyvideo.image scr = easyvideo.screen.Screen() img = easyvideo.image.load('data/sample_image.jpg') try: scr.background.draw(img, (0, 0)) scr.update() except Exception, e: test.failed('Cannot draw image (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Add horizontal-flipped animation to container') import easyvideo.animation animations = easyvideo.animation.Animations() frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animations.add('animation1', frames.horizontal_flip.animation) except Exception, e: test.failed('Cannot add flipped animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Layer drawing') import easyvideo.screen scr = easyvideo.screen.Screen() import random import pygame def _randint(max_val): return random.randint(0, max_val) for circle in range(100): try: pygame.draw.circle(scr.background.layer, (_randint(255), _randint(255), _randint(255), 255), (_randint(1024), _randint(768)), _randint(10)) except Exception, e: test.failed('Cannot draw into layer (%s)' % e) scr.update() test.ok()
rs.format.yuyv and p.as_video_stream_profile().width() == 1280 and p.as_video_stream_profile().height() == 720) dp = next( p for p in depth_sensor.profiles if p.fps() == 30 and p.stream_type() == rs.stream.depth and p.format() == rs.format.z16 and p.as_video_stream_profile().width() == 1024 and p.as_video_stream_profile().height() == 768) depth_sensor.open(dp) depth_sensor.start(lambda f: None) color_sensor.open(cp) color_sensor.start(lambda f: None) ############################################################################################# test.start("Failing check_conditions function") # If ambient light is RS2_DIGITAL_GAIN_LOW (2) receiver_gain must be 18 # If ambient light is RS2_DIGITAL_GAIN_HIGH (1) receiver_gain must be 9 old_receiver_gain = depth_sensor.get_option(rs.option.receiver_gain) depth_sensor.set_option(rs.option.receiver_gain, 15) try: d2r.trigger_device_calibration(rs.calibration_type.manual_depth_to_rgb) test.unreachable() ac.wait_for_calibration() except Exception as e: test.check_exception(e, RuntimeError) else: test.unexpected_exception() test.check_equal_lists(ac.status_list, [rs.calibration_status.bad_conditions]) depth_sensor.set_option(rs.option.receiver_gain, old_receiver_gain) test.finish()