public inbox for [email protected]  
help / color / mirror / Atom feed
From: Akshay Joshi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgadmin4][Patch]: Support for create multiple test classes in one test file
Date: Tue, 12 Jun 2018 19:00:39 +0530
Message-ID: <CANxoLDeRfFgVnpzOw9RttMNtKJ0B9s1822jy9_78FucLFRCdKQ@mail.gmail.com> (raw)

Hi Hackers,

Attached is the patch to create multiple test classes in one test file.

For example: I have one test file *test_feature.py *where I wrote multiple
test classes
    class TestX(BaseTestGenerator):
  class TestY(BaseTestGenerator):
  class TestZ(BaseTestGenerator):

So with current implementation it will run the test cases for *TestZ* class.

-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Attachments:

  [application/octet-stream] multiple_class_support.patch (1.3K, 3-multiple_class_support.patch)
  download | inline diff:
diff --git a/web/pgadmin/utils/route.py b/web/pgadmin/utils/route.py
index f784e53..c04aed5 100644
--- a/web/pgadmin/utils/route.py
+++ b/web/pgadmin/utils/route.py
@@ -51,7 +51,10 @@ class TestsGeneratorRegistry(ABCMeta):
         # Avoid registering the BaseDriver itself
 
         if name != 'BaseTestGenerator' and name != 'BaseFeatureTest':
-            TestsGeneratorRegistry.registry[d['__module__']] = cls
+            if d['__module__'] in TestsGeneratorRegistry.registry:
+                TestsGeneratorRegistry.registry[d['__module__']].append(cls)
+            else:
+                TestsGeneratorRegistry.registry[d['__module__']] = [cls]
 
         ABCMeta.__init__(cls, name, bases, d)
 
diff --git a/web/regression/runtests.py b/web/regression/runtests.py
index d786692..68e018f 100644
--- a/web/regression/runtests.py
+++ b/web/regression/runtests.py
@@ -142,8 +142,9 @@ def get_suite(module_list, test_server, test_app_client, server_information):
 
     # Get the each test module and add into list
     for key, klass in module_list:
-        gen = klass
-        modules.append(gen)
+        for item in klass:
+            gen = item
+            modules.append(gen)
 
     # Set the test client to each module & generate the scenarios
     for module in modules:


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgadmin4][Patch]: Support for create multiple test classes in one test file
  In-Reply-To: <CANxoLDeRfFgVnpzOw9RttMNtKJ0B9s1822jy9_78FucLFRCdKQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox