How to use unittest_refresh_dir_tracker method in avocado

Best Python code snippet using avocado_python

test_suite.py

Source:test_suite.py Github

copy

Full Screen

...7setup_avocado_loggers()8class TestSuiteTest(unittest.TestCase):9 def setUp(self):10 self.suite = None11 data_dir._tmp_tracker.unittest_refresh_dir_tracker()12 prefix = temp_dir_prefix(__name__, self, 'setUp')13 self.tmpdir = tempfile.TemporaryDirectory(prefix=prefix)14 @staticmethod15 def _find_simple_test_candidates(candidates=None):16 if candidates is None:17 candidates = ['true']18 found = []19 for candidate in candidates:20 try:21 found.append(utils_path.find_command(candidate))22 except utils_path.CmdNotFoundError:23 pass24 return found25 def test_custom_suite(self):26 """Custom suites should assume custom tests.27 When using custom suites (from constructor) we are assuming no28 magic, no tests should be created from run.references.29 """30 tests = self._find_simple_test_candidates()31 config = {'run.results_dir': self.tmpdir.name,32 'core.show': ['none'],33 'run.references': tests}34 self.suite = TestSuite(name='foo', config=config)35 self.assertEqual(0, self.suite.size)36 def test_automatic_suite(self):37 """Automatic suites should create tests.38 When using automatic suites we are assuming magic,39 and, tests should be created from run.references.40 """41 tests = self._find_simple_test_candidates()42 config = {'run.results_dir': self.tmpdir.name,43 'core.show': ['none'],44 'run.references': tests}45 self.suite = TestSuite.from_config(config=config)46 self.assertEqual(1, self.suite.size)47 def test_config_extend_manual(self):48 """Test extends config from job when using manual method."""49 tests = self._find_simple_test_candidates()50 job_config = {'run.results_dir': self.tmpdir.name,51 'core.show': ['none']}52 suite_config = {'run.references': tests}53 self.suite = TestSuite(name='foo',54 config=suite_config,55 job_config=job_config)56 self.assertEqual(self.suite.config.get('core.show'), ['none'])57 def test_config_extend_automatic(self):58 """Test extends config from job when using automatic method."""59 tests = self._find_simple_test_candidates()60 job_config = {'run.results_dir': self.tmpdir.name,61 'core.show': ['none']}62 suite_config = {'run.references': tests}63 self.suite = TestSuite.from_config(config=suite_config,64 job_config=job_config)65 self.assertEqual(self.suite.config.get('core.show'), ['none'])66 def tearDown(self):67 data_dir._tmp_tracker.unittest_refresh_dir_tracker()68 self.tmpdir.cleanup()69if __name__ == '__main__':...

Full Screen

Full Screen

run

Source:run Github

copy

Full Screen

...17 def stopTest(self, test):18 # stopTestRun19 super(CheckTmpDirResult, self).stopTest(test)20 # Destroy the data_dir.get_tmpdir ...21 data_dir._tmp_tracker.unittest_refresh_dir_tracker()22 # Rung garbage collection (run __del__s) and force-sync disk23 gc.collect()24 os.sync()25 test_name = str(test)26 try:27 test.tearDown()28 except Exception:29 pass30 # ... and check whether some dirs were left behind31 dir_check = subprocess.Popen([sys.executable, CHECK_TMP_DIRS], stdout=subprocess.PIPE,32 stderr=subprocess.STDOUT)33 if dir_check.wait():34 raise AssertionError("Test %s left some tmp files behind:\n%s"35 % (test_name, dir_check.stdout.read().decode()))...

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