mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-23 15:40:45 -06:00
Add a --modules option to the RE-SQL test suite to allow testing of specific object types. Fixes #4560
This commit is contained in:
parent
ee8fec6d7f
commit
db7a2e3023
@ -19,6 +19,7 @@ Housekeeping
|
||||
************
|
||||
|
||||
| `Issue #4555 <https://redmine.postgresql.org/issues/4555>`_ - Add Reverse Engineered SQL tests for Exclusion Constraint.
|
||||
| `Issue #4560 <https://redmine.postgresql.org/issues/4560>`_ - Add a --modules option to the RE-SQL test suite to allow testing of specific object types.
|
||||
|
||||
Bug fixes
|
||||
*********
|
||||
|
@ -65,7 +65,8 @@ class TestsGeneratorRegistry(ABCMeta):
|
||||
all_modules.append('regression.re_sql.tests.test_resql')
|
||||
|
||||
# If specific modules are to be tested, exclude others
|
||||
if len(for_modules) > 0:
|
||||
# for modules are handled differently for resql
|
||||
if not is_resql_only and len(for_modules) > 0:
|
||||
all_modules = [module_name
|
||||
for module_name in all_modules
|
||||
for fmod in for_modules
|
||||
@ -79,6 +80,7 @@ class TestsGeneratorRegistry(ABCMeta):
|
||||
# Check if only reverse engineered sql test cases to run
|
||||
# if yes then import only that module
|
||||
if is_resql_only:
|
||||
BaseTestGenerator.setForModules(for_modules)
|
||||
try:
|
||||
import_module('regression.re_sql.tests.test_resql')
|
||||
except ImportError:
|
||||
@ -147,3 +149,7 @@ class BaseTestGenerator(unittest.TestCase):
|
||||
@classmethod
|
||||
def setExcludePkgs(cls, exclude_pkgs):
|
||||
cls.exclude_pkgs = exclude_pkgs
|
||||
|
||||
@classmethod
|
||||
def setForModules(cls, for_modules):
|
||||
cls.for_modules = for_modules
|
||||
|
@ -151,6 +151,9 @@ Python Tests:
|
||||
- Execute only reverse engineered sql test framework for all nodes
|
||||
run 'python runtests.py --pkg resql'
|
||||
|
||||
- Execute only reverse engineered sql test framework for some modules
|
||||
run 'python runtests.py --pkg resql --modules sequences,functions'
|
||||
|
||||
- Execute test framework for entire package
|
||||
|
||||
Example 1) Run test framework for 'browser' package
|
||||
|
@ -22,7 +22,7 @@ from pgadmin.utils.versioned_template_loader import \
|
||||
get_version_mapping_directories
|
||||
|
||||
|
||||
def create_resql_module_list(all_modules, exclude_pkgs):
|
||||
def create_resql_module_list(all_modules, exclude_pkgs, for_modules):
|
||||
"""
|
||||
This function is used to create the module list for reverse engineered
|
||||
SQL by iterating all the modules.
|
||||
@ -41,7 +41,13 @@ def create_resql_module_list(all_modules, exclude_pkgs):
|
||||
module_name_list = complete_module_name[0].split(".")
|
||||
module_name = module_name_list[len(module_name_list) - 1]
|
||||
|
||||
resql_module_list[module_name] = os.path.join(*module_name_list)
|
||||
if len(for_modules) > 0:
|
||||
if module_name in for_modules:
|
||||
resql_module_list[module_name] = \
|
||||
os.path.join(*module_name_list)
|
||||
else:
|
||||
resql_module_list[module_name] = \
|
||||
os.path.join(*module_name_list)
|
||||
|
||||
return resql_module_list
|
||||
|
||||
@ -87,7 +93,8 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
|
||||
|
||||
resql_module_list = create_resql_module_list(
|
||||
BaseTestGenerator.re_sql_module_list,
|
||||
BaseTestGenerator.exclude_pkgs)
|
||||
BaseTestGenerator.exclude_pkgs,
|
||||
getattr(BaseTestGenerator, 'for_modules', []))
|
||||
|
||||
for module in resql_module_list:
|
||||
self.table_id = None
|
||||
|
@ -253,9 +253,13 @@ def get_test_modules(arguments):
|
||||
if arguments['pkg'] is None or arguments['pkg'] == "all":
|
||||
TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs)
|
||||
elif arguments['pkg'] is not None and arguments['pkg'] == "resql":
|
||||
for_modules = []
|
||||
if arguments['modules'] is not None:
|
||||
for_modules = arguments['modules'].split(',')
|
||||
|
||||
# Load the reverse engineering sql test module
|
||||
TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs,
|
||||
is_resql_only=True)
|
||||
for_modules, is_resql_only=True)
|
||||
else:
|
||||
for_modules = []
|
||||
if arguments['modules'] is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user