How to use check_output_files method in avocado

Best Python code snippet using avocado_python

text_eval_test.py

Source:text_eval_test.py Github

copy

Full Screen

...49 encoder.decode.return_value = "some test decode value."50 text_eval.text_eval(encoder, features, model_dir, 0, "test", enable_logging,51 **kwargs)52 return model_dir53 def check_output_files(self, model_dir, file_prefixes=_DEFAULT_OUTPUTS):54 for name in file_prefixes:55 filename = os.path.join(model_dir, name + "-0-test.txt")56 self.assertTrue(tf.io.gfile.exists(filename))57 self.assertEqual(58 len(file_prefixes), len(tf.io.gfile.glob(os.path.join(model_dir, "*"))))59 def test_eval(self):60 features = iter([{61 "inputs": np.array([2, 3, 4, 1, 0]),62 "targets": np.array([2, 3, 1, 0]),63 "outputs": np.array([2, 1, 0])64 }])65 self.check_output_files(self.eval(features, True))66 def test_no_logging(self):67 features = iter([{68 "inputs": np.array([2, 3, 4, 1, 0]),69 "targets": np.array([2, 3, 1, 0]),70 "outputs": np.array([2, 1, 0])71 }])72 self.check_output_files(self.eval(features, False), ("text_metrics",))73 def test_2d_inputs(self):74 features = iter([{75 "inputs": np.ones((3, 5)),76 "targets": np.ones((4)),77 "outputs": np.ones((7))78 }])79 self.check_output_files(self.eval(features, True))80 def test_multiple_inputs(self):81 features = iter([{82 "inputs0": np.ones((5)),83 "inputs1": np.ones((5)),84 "inputs2": np.ones((5)),85 "targets": np.ones((4)),86 "outputs": np.ones((7))87 }])88 self.check_output_files(self.eval(features, True))89 def test_selected_ids(self):90 features = iter([{91 "inputs": np.ones((3, 5)),92 "num_inputs": np.array(3).item(),93 "selected_ids": np.array([1, 0]),94 "targets": np.ones((4)),95 "outputs": np.ones((7))96 }])97 self.check_output_files(98 self.eval(features, True, additional_keys=("selected_ids",)),99 _DEFAULT_OUTPUTS + ("selected_ids",))100 def test_addtinal_keys(self):101 features = iter([{102 "inputs": np.ones((3, 5)),103 "key1": np.ones((6, 5)),104 "key2": np.ones((9)),105 "floatkey1": np.ones((9, 3), dtype=np.float32),106 "floatkey2": np.ones((9), dtype=np.float32),107 "targets": np.ones((4)),108 "outputs": np.ones((7))109 }])110 self.check_output_files(111 self.eval(112 features,113 True,114 additional_keys=("key1", "key2", "floatkey1", "floatkey2")),115 _DEFAULT_OUTPUTS + ("key1", "key2", "floatkey1", "floatkey2"))116if __name__ == "__main__":...

Full Screen

Full Screen

integration_antismash.py

Source:integration_antismash.py Github

copy

Full Screen

...25 destroy_config()26 self.temp_dir.cleanup()27 def test_nisin_minimal(self):28 run_antismash(get_path_to_nisin_genbank(), self.default_options)29 self.check_output_files()30 def check_output_files(self):31 out_dir = self.default_options.output_dir32 assert os.path.exists(out_dir)33 for filename in ["nisin.json", "index.html"]:34 assert os.path.exists(os.path.join(out_dir, filename))35class TestSkipZip(TestAntismash):36 def get_args(self):37 return ["--minimal", "--skip-zip-file"]38 def check_output_files(self):39 super().check_output_files()40 assert not os.path.exists(os.path.join(self.default_options.output_dir, "nisin.zip"))41class TestProfiling(TestAntismash):42 def get_args(self):43 return ["--minimal", "--profiling"]44class TestDebug(TestAntismash):45 def get_args(self):46 return ["--minimal", "-d"]47class TestVerbose(TestAntismash):48 def get_args(self):49 return ["--minimal", "-v"]50class TestLogging(TestAntismash):51 def setUp(self):52 self.logfile = NamedTemporaryFile()53 super().setUp()54 def tearDown(self):55 super().tearDown()56 self.logfile.close()57 def get_args(self):58 return ["--minimal", "-v", "--logfile", os.path.join(self.logfile.name)]59 def check_output_files(self):60 super().check_output_files()61 assert os.path.exists(self.logfile.name)62class TestResultsReuse(TestAntismash):63 def test_nisin_minimal(self):64 # make sure the output directory isn't filled65 out_dir = self.default_options.output_dir66 assert not list(glob.glob(os.path.join(out_dir, "*")))67 # die with neither inputs provided68 with self.assertRaisesRegex(ValueError, "No sequence file or prior results to read"):69 run_antismash(None, self.default_options)70 # make sure no files created71 assert not list(glob.glob(os.path.join(out_dir, "*")))72 # do a normal run73 run_antismash(get_path_to_nisin_genbank(), self.default_options)74 self.check_output_files()75 # remove html file and make sure it's recreated76 os.unlink(os.path.join(self.default_options.output_dir, "index.html"))77 update_config({"reuse_results": os.path.join(self.default_options.output_dir, "nisin.json")})78 run_antismash(None, self.default_options)79 self.check_output_files()80class TestModuleData(unittest.TestCase):81 def test_prepare_module_data(self):82 # make sure there's some to start with83 search = path.get_full_path(antismash.__file__, '**', "*.h3?")84 existing_press_files = glob.glob(search, recursive=True)85 assert existing_press_files86 # then remove them all87 for pressed in existing_press_files:88 os.unlink(pressed)89 current_press_files = glob.glob(search, recursive=True)90 assert not current_press_files91 # and make sure they're all regenerated properly92 prepare_module_data()93 current_press_files = glob.glob(search, recursive=True)...

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