summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin/plugin_base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-08-21 17:13:12 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-08-21 17:13:12 -0400
commita61ff195b5687b32828e1bc4d958c5cd87e94ff0 (patch)
tree83b50bc616fd7da79913be96a1e2cb3f59374ec7 /lib/sqlalchemy/testing/plugin/plugin_base.py
parenta2beb234e87479174d127db77b6d39baf05de255 (diff)
downloadsqlalchemy-a61ff195b5687b32828e1bc4d958c5cd87e94ff0.tar.gz
- sanitize class names for junit reporting
Change-Id: I42821d8324208b708adc17a10b1a2758797cb9db
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/plugin_base.py')
-rw-r--r--lib/sqlalchemy/testing/plugin/plugin_base.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index cab93a0e7..ca8abaa8e 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -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, ),