How to use get_tmp_dir method in avocado

Best Python code snippet using avocado_python

graph.py

Source:graph.py Github

copy

Full Screen

...53 pass54 args = args[2:]55 def before_evaluate(self):56 self.reset_options()57 if not os.path.exists(self.get_tmp_dir()):58 os.mkdir(self.get_tmp_dir())59 def evaluate(self, code):60 pass61 def after_evaluate(self):62 self.clean_tmp_dir()63 self.remove_tmp_dir()64 def eval(self, code):65 self.before_evaluate()66 if (code.startswith("%")):67 magic_lines = code.split("\n")68 magic_line = magic_lines[0]69 self.apply_magic(magic_line)70 code = '\n'.join(magic_lines[1:])71 self.evaluate(code)72 time.sleep(1)73 self.after_evaluate()74 def main_loop(self):75 # Main session loop.76 while True:77 line = tm_input()78 if not line:79 continue80 if line[0] == DATA_COMMAND:81 # TODO: Handle completions82 continue83 else:84 lines = [line]85 while line != "<EOF>":86 line = tm_input()87 lines.append(line)88 text = '\n'.join(lines[:-1])89 self.eval(text)90 def get_tmp_dir(self):91 dir = "graph_" + self.name + "_" + str(os.getpid())92 if (platform.system() == "Windows"):93 return os.getenv("TEXMACS_HOME_PATH") + "\\system\\tmp\\" + dir + "\\"94 else:95 return os.getenv("TEXMACS_HOME_PATH") + "/system/tmp/" + dir + "/"96 def remove_tmp_dir(self):97 if (platform.system() != "Windows"):98 os.rmdir(self.get_tmp_dir())99 def clean_tmp_dir(self):100 folder = self.get_tmp_dir()101 for the_file in os.listdir(folder):102 file_path = os.path.join(folder, the_file)103 try:104 if os.path.isfile(file_path):105 os.unlink(file_path)106 elif os.path.isdir(file_path):107 shutil.rmtree(file_path)108 except Exception as e:109 print(e)110 def get_png_path(self):111 return self.get_tmp_dir() + self.name + ".png"112 def get_eps_path(self):113 return self.get_tmp_dir() + self.name + ".eps"114 def get_svg_path(self):115 return self.get_tmp_dir() + self.name + ".svg"116 def get_png(self):117 return self.get_png_path() +\118 "?" + "width=" + str(self.width) +\119 "&" + "height=" + str(self.height)120 def get_eps(self):121 return self.get_eps_path() +\122 "?" + "width=" + str(self.width) +\123 "&" + "height=" + str(self.height)124 def get_svg(self):125 return self.get_svg_path() +\126 "?" + "width=" + str(self.width) +\...

Full Screen

Full Screen

test_helpers.py

Source:test_helpers.py Github

copy

Full Screen

...9# python3 -m pytest -q test*.py10# python3 -m pytest -q test_utils.py::test_download_file11# pytest --exitfirst --verbose --failed-first12@pytest.fixture(scope="session")13def get_tmp_dir(tmp_path_factory):14 fn = tmp_path_factory.mktemp("data")15 return fn16def test_generate_secure_name():17 filename = generate_secure_name("ö.txt")18 assert filename == "o.txt"19"""20def test_json_matcher(httpserver: HTTPServer):21 httpserver.expect_request("/foo", json={"foo": "bar"}).respond_with_data("Hello world!")22 assert requests.get(httpserver.url_for("/foo")).status_code == 50023 resp = requests.get(httpserver.url_for("/foo"), json={"foo": "bar"})24 assert resp.status_code == 20025 assert resp.text == "Hello world!"26 assert requests.get(httpserver.url_for("/foo"), json={"foo": "bar", "foo2": "bar2"}).status_code == 50027"""...

Full Screen

Full Screen

test_files.py

Source:test_files.py Github

copy

Full Screen

...3from pathlib import Path4import pytest5from gumly.files import *6@pytest.fixture()7def get_tmp_dir():8 tmp_dir = Path(tempfile.mkdtemp())9 tmp_dir.mkdir(parents=True, exist_ok=True)10 yield tmp_dir11 shutil.rmtree(str(tmp_dir))12src_tmp_dir = get_tmp_dir13dst_tmp_dir = get_tmp_dir14def test_move_file(src_tmp_dir, dst_tmp_dir):15 test_file = src_tmp_dir / "test.txt"16 with open(test_file, "w") as fd:17 fd.write("Testando para ver se move")18 assert not (dst_tmp_dir / "test.txt").is_file()19 move_files(str(src_tmp_dir), str(dst_tmp_dir))20 assert (dst_tmp_dir / "test.txt").is_file()21def test_create_non_existing_dir(get_tmp_dir):...

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