How to use _is_uri_a_file_on_cwd method in avocado

Best Python code snippet using avocado_python

exec_test.py

Source:exec_test.py Github

copy

Full Screen

...81 if runnable.output_dir:82 avocado_test_env_variables["AVOCADO_TEST_OUTPUTDIR"] = runnable.output_dir83 return avocado_test_env_variables84 @staticmethod85 def _is_uri_a_file_on_cwd(uri):86 if (87 uri is not None88 and os.path.basename(uri) == uri89 and os.access(uri, os.R_OK | os.X_OK)90 ):91 return True92 return False93 def _get_env(self, runnable):94 env = dict(os.environ)95 if runnable.kwargs:96 env.update(runnable.kwargs)97 # set default Avocado environment variables if running on a valid Task98 if runnable.uri is not None:99 avocado_test_env_variables = self._get_env_variables(runnable)100 # save environment variables for further cleanup101 runnable.kwargs.update(avocado_test_env_variables)102 if env is None:103 env = avocado_test_env_variables104 else:105 env.update(avocado_test_env_variables)106 params = self._create_params(runnable)107 if params:108 env.update(params)109 if env and "PATH" not in env:110 env["PATH"] = os.environ.get("PATH")111 # Support for running executable tests in the current working directory112 if self._is_uri_a_file_on_cwd(runnable.uri):113 env["PATH"] += f":{os.getcwd()}"114 return env115 def _run_proc(self, runnable):116 return subprocess.Popen(117 [runnable.uri] + list(runnable.args),118 stdin=subprocess.DEVNULL,119 stdout=subprocess.PIPE,120 stderr=subprocess.PIPE,121 env=self._get_env(runnable),122 )123 def run(self, runnable):124 yield self.prepare_status("started")125 try:126 process = self._run_proc(runnable)...

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