]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
- santitize brackets / periods from classnames for junitxml
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Aug 2017 21:16:47 +0000 (17:16 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Aug 2017 21:16:47 +0000 (17:16 -0400)
Change-Id: I1071bd70fd4166937b07536725f0900cba03d86b

alembic/testing/plugin/plugin_base.py

index 31f34e2b0852adb155d237ba86b1f6aa0bea9b8e..7b27e69e68ec94afbf13a85967356d17c783ba75 100644 (file)
@@ -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, ),