How to use _setup_play method in pytest-play

Best Python code snippet using pytest-play_python

plugin.py

Source:plugin.py Github

copy

Full Screen

...160 [])161 def setup(self):162 super(YAMLItem, self).setup()163 fixtures.fillfixtures(self)164 self._setup_play()165 self._setup_raw_data()166 def _setup_play(self):167 self.play = self._request.getfixturevalue('play')168 def _setup_raw_data(self):169 self.raw_data = self.play and self.play.get_file_contents(170 self.path)171 def runtest(self):172 data = self.play.get_file_contents(self.path)173 self.play.execute_raw(data, extra_variables=self.test_data)174@pytest.fixture175def play_engine_class():176 """ Play engine class class """177 from .engine import PlayEngine178 return PlayEngine179@pytest.fixture180def play(request, play_engine_class, variables):...

Full Screen

Full Screen

gui_controller.py

Source:gui_controller.py Github

copy

Full Screen

...20 self.vtk_file = vtk_file21 self.tempdir = None22 self.vtk_exporter = None23 self.viewer = viewer24 self._setup_play()25 def __enter__(self):26 self.panic = False27 self.set_percent(0)28 def __exit__(self, *_):29 if self.panic:30 self._setup_play()31 else:32 self._setup_save()33 self.panic = False34 self.progress.description = " "35 def reinit(self, _=None):36 self.panic = True37 self._setup_play()38 self.progress.value = 039 self.progress.description = " "40 self.viewer.clear()41 self.link.children = ()42 self.vtk_exporter = None43 def box(self):44 netcdf_box = Checkbox(45 description="netCDF output",46 disabled=True,47 value=True,48 indent=False,49 layout={"width": "125px"},50 )51 return HBox([self.progress, self.button, netcdf_box, self.checkbox, self.link])52 def set_percent(self, value):53 self.progress.value = value54 def _setup_play(self):55 self.button.on_click(self._handle_stop, remove=True)56 self.button.on_click(self._handle_save, remove=True)57 self.button.on_click(self._handle_play)58 self.button.icon = "play"59 self.button.description = "start simulation"60 self.checkbox.disabled = False61 def _setup_stop(self):62 self.button.on_click(self._handle_play, remove=True)63 self.button.on_click(self._handle_save, remove=True)64 self.button.on_click(self._handle_stop)65 self.button.icon = "stop"66 self.button.description = "interrupt"67 def _setup_save(self):68 self.button.icon = "download"69 self.button.description = "save output"70 self.button.on_click(self._handle_stop, remove=True)71 self.button.on_click(self._handle_save)72 def _handle_stop(self, _):73 self.panic = True74 while self.panic:75 sleep(0.1)76 self._setup_play()77 def _handle_play(self, _):78 self._setup_stop()79 self.link.children = ()80 self.progress.value = 081 self.progress.description = "initialisation"82 self.checkbox.disabled = True83 if self.checkbox.value:84 self.tempdir = TemporaryDirectory()85 self.vtk_exporter = VTKExporter(verbose=False, path=self.tempdir.name)86 self.thread = Thread(target=self.simulator.run, args=(self, self.vtk_exporter))87 self.simulator.reinit()88 self.thread.start()89 self.progress.description = "running"90 self.viewer.reinit(self.simulator.products)...

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 pytest-play 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