mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-21 16:27:39 -06:00
Ensure that code coverage should cover class and function declarations. Fixes #6062
This commit is contained in:
parent
146da066b0
commit
ca4db8871e
6
.gitignore
vendored
6
.gitignore
vendored
@ -51,4 +51,8 @@ auditjs.html
|
||||
auditpy.txt
|
||||
/venv/
|
||||
.scannerwork/
|
||||
web/coverage/
|
||||
web/coverage/
|
||||
web/.coverage
|
||||
web/regression/.coverage
|
||||
web/regression/covhtml/
|
||||
web/regression/htmlcov/
|
||||
|
@ -17,6 +17,7 @@ Housekeeping
|
||||
| `Issue #5337 <https://redmine.postgresql.org/issues/5337>`_ - Improve code coverage and API test cases for Views and Materialized Views.
|
||||
| `Issue #5343 <https://redmine.postgresql.org/issues/5343>`_ - Improve code coverage and API test cases for Debugger.
|
||||
| `Issue #6033 <https://redmine.postgresql.org/issues/6033>`_ - Update the cryptography python package for Python 3.5 and above.
|
||||
| `Issue #6062 <https://redmine.postgresql.org/issues/6062>`_ - Ensure that code coverage should cover class and function declarations.
|
||||
|
||||
Bug fixes
|
||||
*********
|
||||
|
@ -279,13 +279,16 @@ How to generate code coverage report for API test-suite?
|
||||
|
||||
- Run coverage
|
||||
With all modules
|
||||
run 'python runtests.py --coverage --exclude feature_tests'
|
||||
run `coverage run ./runtests.py --exclude feature_tests`
|
||||
With specific module
|
||||
run 'python runtests.py --pkg browser.server_groups.servers.tests --coverage'
|
||||
run `coverage run ./runtests.py --exclude feature_tests --pkg browser.server_groups.servers.tests`
|
||||
|
||||
- After execution of coverage, we will see code coverage report on console.
|
||||
For a nicer presentation, '/regression/covhtml' directory gets created.
|
||||
Open 'index.html' file in browser and you will see detail coverage report.
|
||||
- After execution of coverage, you can run the following to see the code coverage report:
|
||||
Normal report:
|
||||
run `coverage report`
|
||||
HTML report:
|
||||
run `coverage html`
|
||||
This will create a directory 'htmlcov'. Open 'index.html' file in browser and you will see detail coverage report.
|
||||
|
||||
Javascript Tests:
|
||||
|
||||
|
@ -19,7 +19,6 @@ import sys
|
||||
import traceback
|
||||
import json
|
||||
import random
|
||||
import coverage
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
@ -49,8 +48,6 @@ if sys.path[0] != root:
|
||||
from pgadmin import create_app
|
||||
import config
|
||||
|
||||
COVERAGE_CONFIG_FILE = os.path.join(CURRENT_PATH, ".coveragerc")
|
||||
|
||||
if config.SERVER_MODE is True:
|
||||
config.SECURITY_RECOVERABLE = True
|
||||
config.SECURITY_CHANGEABLE = True
|
||||
@ -357,8 +354,6 @@ def add_arguments():
|
||||
help='Skips execution of the test cases of particular package and '
|
||||
'sub-packages'
|
||||
)
|
||||
parser.add_argument('--coverage', nargs='?', const=True, type=bool,
|
||||
default=False, help='Enable code coverage feature')
|
||||
parser.add_argument(
|
||||
'--default_browser',
|
||||
help='Executes the feature test in specific browser'
|
||||
@ -776,11 +771,6 @@ if __name__ == '__main__':
|
||||
if args['pkg'] is not None:
|
||||
node_name = args['pkg'].split('.')[-1]
|
||||
|
||||
# Start coverage
|
||||
if test_utils.is_coverage_enabled(args):
|
||||
cov = coverage.Coverage(config_file=COVERAGE_CONFIG_FILE)
|
||||
cov.start()
|
||||
|
||||
# Check if feature tests included & parallel tests switch passed
|
||||
if test_utils.is_feature_test_included(args) and \
|
||||
test_utils.is_parallel_ui_tests(args):
|
||||
@ -887,15 +877,6 @@ if __name__ == '__main__':
|
||||
raise
|
||||
print_test_results()
|
||||
|
||||
# Stop code coverage
|
||||
if test_utils.is_coverage_enabled(args):
|
||||
cov.stop()
|
||||
cov.save()
|
||||
|
||||
# Print coverage only if coverage args given in command line
|
||||
if test_utils.is_coverage_enabled(args):
|
||||
test_utils.print_and_store_coverage_report(cov)
|
||||
|
||||
print("Please check output in file: %s/regression.log\n" % CURRENT_PATH)
|
||||
|
||||
# Unset environment variable
|
||||
|
Loading…
Reference in New Issue
Block a user