Best Python code snippet using avocado_python
check.py
Source:check.py
...118 result = self.run_job()119 # Asserts120 self.check_exit_code(result)121 self.check_file_exists(self.workdir_file_path)122 def test_check_output_file(self):123 """Test to check if the file passed as parameter was created."""124 config = self.create_config(self.workdir_file_path)125 suite = TestSuite.from_config(config)126 # run the job127 with Job(config, [suite]) as j:128 result = j.run()129 # Asserts130 self.check_exit_code(result)131 self.check_file_exists(self.workdir_file_path)132 def test_check_tmp_directory_exists(self):133 """Test to check if the temporary directory was created."""134 config = self.create_config()135 suite = TestSuite.from_config(config)136 # run the job...
test_command_line.py
Source:test_command_line.py
...17 units_of_time,18 version_parser,19)20ureg = pint.UnitRegistry()21def test_check_output_file(tmp_path):22 """Test the function for checking for a valid output file name."""23 assert check_output_file() is None24 assert check_output_file(out_file="test.ext") == Path("test.ext").resolve()25 assert check_output_file(stem="test") == Path("test_output.h5").resolve()26 assert (27 check_output_file(stem="test", suffix="other")28 == Path("test_other.h5").resolve()29 )30 test_file = tmp_path / "test.ext"31 test_file.touch()32 with pytest.raises(SystemExit, match="This output file already exists:"):33 check_output_file(out_file=test_file)34 assert check_output_file(out_file=test_file, force=True) == test_file35def test_data_files(dummy_data_transient):...
test_cli.py
Source:test_cli.py
...3import dinf.cli4from tests import capture5from .test_dinf import check_discriminator, check_npz6@pytest.mark.usefixtures("tmp_path")7def test_check_output_file(tmp_path):8 file = tmp_path / "foo"9 dinf.cli._check_output_file(file)10 # If it succeeds, it should succeed again.11 dinf.cli._check_output_file(file)12 file.touch()13 # The file is not allowed to exist already.14 with pytest.raises(ValueError, match="file already exists"):15 dinf.cli._check_output_file(file)16 # Directory. Should raise an error, but we don't care what type.17 with pytest.raises(Exception):18 dinf.cli._check_output_file(tmp_path)19 inaccessible_folder = tmp_path / "inaccessible"20 inaccessible_folder.mkdir()21 inaccessible_folder.chmod(0o000)...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!