From 61c288d889eef16a012a721d0fddab33467c861e Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 30 Nov 2016 11:40:27 -0200 Subject: Extract slugify method --- service/test/functional/features/environment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'service/test/functional') 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) -- cgit v1.2.3