diff options
author | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-11-30 11:40:27 -0200 |
---|---|---|
committer | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-11-30 11:40:27 -0200 |
commit | 61c288d889eef16a012a721d0fddab33467c861e (patch) | |
tree | c1d1672d6ff09da95b7f1576bac1c3232ec6bb9b | |
parent | cf55bf8e3657a13b230cd56787e0c941b2a596e9 (diff) |
Extract slugify method
-rw-r--r-- | service/test/functional/features/environment.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py index ce880a87..b03c506e 100644 --- a/service/test/functional/features/environment.py +++ b/service/test/functional/features/environment.py @@ -90,11 +90,13 @@ def _save_screenshot(context, step): if (step.status == 'failed' and context.config.userdata.getbool("screenshots", True)): timestamp = time.strftime("%Y-%m-%d-%H-%M-%S") - filename = re.sub('\W', '-', timestamp + ' failed ' + str(step.name)) + filename = _slugify('{} failed {}'.format(timestamp, str(step.name))) filepath = os.path.join('screenshots', filename + '.png') context.browser.save_screenshot(filepath) +def _slugify(string_): + return re.sub('\W', '-', string_) @wait_for(timeout=10.0) |