]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Restore original test names
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 14 Aug 2017 13:32:08 +0000 (09:32 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 14 Aug 2017 13:34:28 +0000 (09:34 -0400)
The change in de1f8f8345ecd6af0ec1177703465e9471cfe862
modified how test classes are named, breaking logic that
extracts the class name for the profiling suite.
Add a new variable _sa_orig_cls_name if we've modified the
name so that the profiling logic doesn't need to guess
the original class name.

Change-Id: Ica15a97408b9e0749a78c87f62749c15c1627009

lib/sqlalchemy/testing/plugin/plugin_base.py

index e01fa9bd0cc8f9234f5cc9abbf6a8a93d6766fc6..ab968a379555ba9884d572f37459d6afde775980 100644 (file)
@@ -409,11 +409,13 @@ def want_method(cls, fn):
 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)
             subcls = type(
                 name,
                 (cls, ),
                 {
+                    "_sa_orig_cls_name": orig_name,
                     "__only_on_config__": cfg
                 }
             )
@@ -459,11 +461,8 @@ def before_test(test, test_module_name, test_class, test_name):
 
     # like a nose id, e.g.:
     # "test.aaa_profiling.test_compiler.CompileTest.test_update_whereclause"
-    name = test_class.__name__
 
-    suffix = "_%s_%s" % (config.db.name, config.db.driver)
-    if name.endswith(suffix):
-        name = name[0:-(len(suffix))]
+    name = getattr(test_class, '_sa_orig_cls_name', test_class.__name__)
 
     id_ = "%s.%s.%s" % (test_module_name, name, test_name)