From: Mike Bayer Date: Mon, 21 Aug 2017 21:13:12 +0000 (-0400) Subject: - sanitize class names for junit reporting X-Git-Tag: rel_1_1_14~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f27454fd3a82a632ee6b05a066eabdbb7071cee;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - sanitize class names for junit reporting Change-Id: I42821d8324208b708adc17a10b1a2758797cb9db (cherry picked from commit a61ff195b5687b32828e1bc4d958c5cd87e94ff0) --- diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index ab25292201..aeae944fe0 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -426,7 +426,14 @@ def generate_sub_tests(cls, module): if getattr(cls, '__backend__', False): for cfg in _possible_configs_for_cls(cls): orig_name = cls.__name__ - name = "%s_%s" % (cls.__name__, cfg.name) + + # we can have special chars in these names except for the + # pytest junit plugin, which is tripped up by the brackets + # and periods, so sanitize + + alpha_name = re.sub('[_\[\]\.]+', '_', cfg.name) + alpha_name = re.sub('_+$', '', alpha_name) + name = "%s_%s" % (cls.__name__, alpha_name) subcls = type( name, (cls, ),