From: Mike Bayer Date: Mon, 21 Aug 2017 21:16:47 +0000 (-0400) Subject: - santitize brackets / periods from classnames for junitxml X-Git-Tag: rel_0_9_6~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d0bae0d3e52ca68b4ef4d80bcf13123ca871573;p=thirdparty%2Fsqlalchemy%2Falembic.git - santitize brackets / periods from classnames for junitxml Change-Id: I1071bd70fd4166937b07536725f0900cba03d86b --- diff --git a/alembic/testing/plugin/plugin_base.py b/alembic/testing/plugin/plugin_base.py index 31f34e2b..7b27e69e 100644 --- a/alembic/testing/plugin/plugin_base.py +++ b/alembic/testing/plugin/plugin_base.py @@ -412,7 +412,16 @@ 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, ),