Re: pgAdmin IV : Unittest modular patch - Mailing list pgadmin-hackers

From Navnath Gadakh
Subject Re: pgAdmin IV : Unittest modular patch
Date
Msg-id CAOAJCYqQQ4MaudVaVwfcateuxum-W39HwRiEorhYP8zbqjxN0g@mail.gmail.com
Whole thread Raw
In response to Re: pgAdmin IV : Unittest modular patch  (Dave Page <dave.page@enterprisedb.com>)
Responses Re: pgAdmin IV : Unittest modular patch  (Dave Page <dave.page@enterprisedb.com>)
List pgadmin-hackers

Hi Dave,

  Please find the revised patch for unit tests of pgAdmin4 APIs.

This patch includes-

  1. test_advance_config.json(for user it’s test_advance_config.json.in) for advance test configuration for database/server(Priyanka was working on this)

  2. test_config.json(for user it’s test_config_json.in) for basic credentials data for database/server

  3. From now onward we can execute test cases node wise/package wise. I have slightly modified the way of running the testsuite. We used the command line arguments(pkg) which denotes for which package testsuite going to run.


          Run the testsuite for all packages by following command

               Python regression/testsuite.py --pkg all

      Here, ‘all’ means for all python packages(i.e.browser,server_groups,server,

                            databases etc. which are same names in project directory structure)

               This will find the ‘tests’ directory in each package & execute the test cases.

     

          Run the testsuite for single package by following command

      Python regression/testsuite.py --pkg browser (this execute the tests in ‘browser’ package only)

       Python regression/testsuite.py --pkg browser.server_groups.servers.databases (this execute the tests in ‘databases’ package only)  

  4.  Logger file. Which include the detailed output of the testsuite. Testsuite also prints the test summary on the console.

    5.  Previously, we set the priority to each test case. In this patch priority logic is removed as there is no need to set priority.

    6. Resolution of AttributeError for attribute 'APP_ROOT'(Which is mentioned by you in a previous email)

Note: You might get ‘AttributeError’ while running this patch on Python 3.4 (I have raised this bug in RM(#1464)), But still you can run the testsuite. It will run on Python 2.7 without error.



On Fri, Jul 15, 2016 at 6:23 PM, Dave Page <dave.page@enterprisedb.com> wrote:
Hi

On Mon, Jul 11, 2016 at 2:16 PM, Navnath Gadakh <navnath.gadakh@enterprisedb.com> wrote:
Hi Dave,
PFA updated patch for modular API test cases.

On Mon, Jul 11, 2016 at 5:11 PM, Dave Page <dave.page@enterprisedb.com> wrote:


On Fri, Jul 8, 2016 at 2:30 PM, Navnath Gadakh <navnath.gadakh@enterprisedb.com> wrote:

Hi Dave,

PFA patch for modular API test cases.

Kindly, review the same and let me know for any modification. 

Please re-create the patch so that it doesn't revert various changes made to config.py etc. over the last couple of weeks. 

  config.py file was not updated at my end, I have updated it in the current patch.  I have also added code related to advance test data configuration which was created by Priyanka (Seprated the test data configuration files).


What is the patch for? Is it fixing issues in Priyanka's last patch, or something else?

This patch is for -
1. Now we can run testsuite node/module wise(like for browser only, for databases only)  OR for all nodes/modules
2. I have modified the existing functionality for testsuite and all test case classes (Made all test cases independently runnable, removed the priority logic).
     
    For more details please refer the file 'regression/README'.

When running all tests, I get:

...
...
 <Rule '//static/<filename>' (HEAD, OPTIONS, GET) -> redirects.static>,
 <Rule '/backup/<filename>' (HEAD, OPTIONS, GET) -> backup.static>,
 <Rule '/reset/<token>' (HEAD, POST, OPTIONS, GET) -> security.reset_password>,
 <Rule '/about/<filename>' (HEAD, OPTIONS, GET) -> about.static>])
Traceback (most recent call last):
  File "regression/testsuite.py", line 151, in <module>
    suite = get_suite(args, test_client)
  File "regression/testsuite.py", line 75, in get_suite
    TestsGeneratorRegistry.load_generators('pgadmin')
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/route.py", line 56, in load_generators
    module = import_module(module_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/tests/test_db_add.py", line 14, in <module>
    from regression import test_utils as utils
  File "/Users/dpage/git/pgadmin4/web/regression/test_utils.py", line 23, in <module>
    def get_ids(url=config.APP_ROOT + '/regression/parent_id.pkl'):
AttributeError: 'module' object has no attribute 'APP_ROOT'

That's not overly surprising, as we don't have an APP_ROOT setting in the config (nor should we - it should be calculated dynamically). Please fix, and remember to test your patches against a clean copy of the git tree in the future!

Thanks!

--
Dave Page
VP, Chief Architect, Tools & Installers
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake



--
Thanks,
Navnath Gadakh
Software Engineer
EnterpriseDB Corporation
Mobile: +91 9975389878 


Attachment

pgadmin-hackers by date:

Previous
From: Neel Patel
Date:
Subject: Re: PATCH: Fix the issue for saving query output as CSV
Next
From: Dave Page
Date:
Subject: pgAdmin 4 commit: Enhancements to the regression test suite.