]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- sanitize class names for junit reporting
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Aug 2017 21:13:12 +0000 (17:13 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Aug 2017 21:13:12 +0000 (17:13 -0400)
Change-Id: I42821d8324208b708adc17a10b1a2758797cb9db

lib/sqlalchemy/testing/plugin/plugin_base.py

index cab93a0e7a771503678bbe3d181557b91d1acfc6..ca8abaa8e33e3783ace37985569579efdb74003b 100644 (file)
@@ -423,7 +423,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, ),