Update methods and console scripts
- Add the
has_exception()
method for use in a tearDown() step.
"""
(This method should ONLY be used in custom tearDown() methods.)
This method returns True if the test failed or raised an exception.
This is useful for performing additional steps in your tearDown()
method (based on whether or not the test passed or failed).
Example use cases:
* Performing cleanup steps if a test didn't complete.
* Sending test data and/or results to a dashboard service.
"""
- Update the boilerplate example by adding
has_exception()
usage.
def tearDown(self):
self.save_teardown_screenshot()
if self.has_exception():
# <<< Run custom code if the test failed. >>>
pass
else:
# <<< Run custom code if the test passed. >>>
pass
# (Wrap unreliable tearDown() code in a try/except block.)
# <<< Run custom tearDown() code BEFORE the super().tearDown() >>>
super(BaseTestCase, self).tearDown()
- Update the
sbase mkdir DIR_NAME
console script. - Fix the xpath-to-css-selector converter.
- Update Python dependencies (
pytest-xdist
andrich
).