How to use wait_for_env_startup method in tox

Best Python code snippet using tox_python

test_parallel_interrupt.py

Source:test_parallel_interrupt.py Github

copy

Full Screen

...47 import psutil48 current_process = psutil.Process(process.pid)49 except ImportError:50 current_process = None51 wait_for_env_startup(process)52 all_children = []53 if current_process is not None:54 all_children.append(current_process)55 all_children.extend(current_process.children(recursive=True))56 assert len(all_children) >= 1 + 2 + 2, all_children57 end = datetime.now() - start58 assert end59 process.send_signal(signal.CTRL_C_EVENT if sys.platform == "win32" else signal.SIGINT)60 process.wait()61 out, err = capfd.readouterr()62 output = "{}\n{}".format(out, err)63 assert "KeyboardInterrupt parallel - stopping children" in output, output64 assert "ERROR: a: parallel child exit code " in output, output65 assert "ERROR: b: parallel child exit code " in output, output66 for process in all_children:67 msg = "{}{}".format(output, "\n".join(repr(i) for i in all_children))68 assert not process.is_running(), msg69def wait_for_env_startup(process):70 """the environments will write files once they are up"""71 signal_files = [Path() / "a", Path() / "b"]72 found = False73 while True:74 if process.poll() is not None:75 break76 for signal_file in signal_files:77 if not signal_file.exists():78 break79 else:80 found = True81 break82 if not found or process.poll() is not None:83 missing = [f for f in signal_files if not f.exists()]...

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 tox 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