public inbox for [email protected]  
help / color / mirror / Atom feed
[pgadmin4][Patch]: Support for create multiple test classes in one test file
3+ messages / 3 participants
[nested] [flat]

* [pgadmin4][Patch]: Support for create multiple test classes in one test file
@ 2018-06-12 13:30  Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Akshay Joshi @ 2018-06-12 13:30 UTC (permalink / raw)
  To: pgadmin-hackers

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:


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [pgadmin4][Patch]: Support for create multiple test classes in one test file
@ 2018-06-12 13:42  Joao De Almeida Pereira <[email protected]>
  parent: Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Joao De Almeida Pereira @ 2018-06-12 13:42 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Hello Hackers,
Instead of doing this change and include more test harnessing to the setup
we have, do you think we can try to push to get pytest into the code base
and all these features will come by default?

Thanks
Joao
​

On Tue, Jun 12, 2018 at 9:30 AM Akshay Joshi <[email protected]>
wrote:

> 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*
>


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [pgadmin4][Patch]: Support for create multiple test classes in one test file
@ 2018-06-13 08:24  Dave Page <[email protected]>
  parent: Joao De Almeida Pereira <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Dave Page @ 2018-06-13 08:24 UTC (permalink / raw)
  To: Joao De Almeida Pereira <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers

On Tue, Jun 12, 2018 at 2:42 PM, Joao De Almeida Pereira <
[email protected]> wrote:

> Hello Hackers,
> Instead of doing this change and include more test harnessing to the setup
> we have, do you think we can try to push to get pytest into the code base
> and all these features will come by default?
>
Agreed.



> Thanks
> Joao
> ​
>
> On Tue, Jun 12, 2018 at 9:30 AM Akshay Joshi <
> [email protected]> wrote:
>
>> 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*
>>
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-06-13 08:24 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 13:30 [pgadmin4][Patch]: Support for create multiple test classes in one test file Akshay Joshi <[email protected]>
2018-06-12 13:42 ` Joao De Almeida Pereira <[email protected]>
2018-06-13 08:24   ` Dave Page <[email protected]>

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