How to use _write_state_file method in molecule

Best Python code snippet using molecule_python

state.py

Source:state.py Github

copy

Full Screen

...47 """48 self._config = config49 self._state_file = self._get_state_file()50 self._data = self._get_data()51 self._write_state_file()52 def marshal(func):53 def wrapper(self, *args, **kwargs):54 func(self, *args, **kwargs)55 self._write_state_file()56 return wrapper57 @property58 def state_file(self):59 return self._state_file60 @property61 def converged(self):62 return self._data.get("converged")63 @property64 def created(self):65 return self._data.get("created")66 @property67 def driver(self):68 return self._data.get("driver")69 @property70 def prepared(self):71 return self._data.get("prepared")72 @property73 def run_uuid(self):74 return self._data.get("run_uuid")75 @property76 def is_parallel(self):77 return self._data.get("is_parallel")78 @marshal # type: ignore79 def reset(self):80 self._data = self._default_data()81 @marshal # type: ignore82 def change_state(self, key, value):83 """84 Change the state of the instance data with the given \85 ``key`` and the provided ``value``.86 Wrapping with a decorator is probably not necessary.87 :param key: A ``str`` containing the key to update88 :param value: A value to change the ``key`` to89 :return: None90 """91 if key not in VALID_KEYS:92 raise InvalidState93 self._data[key] = value94 def _get_data(self):95 if os.path.isfile(self.state_file):96 return self._load_file()97 return self._default_data()98 def _default_data(self):99 return {100 "converged": False,101 "created": False,102 "driver": None,103 "prepared": None,104 "run_uuid": self._config._run_uuid,105 "is_parallel": self._config.is_parallel,106 }107 def _load_file(self):108 return util.safe_load_file(self.state_file)109 def _write_state_file(self):110 util.write_file(self.state_file, util.safe_dump(self._data))111 def _get_state_file(self):...

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