public inbox for [email protected]
help / color / mirror / Atom feedFrom: Aditya Toshniwal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin[RM6062] Code coverage does not cover function or class definitions
Date: Fri, 4 Dec 2020 15:26:10 +0530
Message-ID: <CAM9w-_=gmiWOhSDegMScZV1SX8FhFs6n7CRHE4b4D10B7bBpgA@mail.gmail.com> (raw)
Hi Hackers,
Attached code will remove the existing code coverage code and recommend to
use the "coverage" command line instead.
Existing coverage does not cover class and function declarations.
Please review.
--
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
<http://edbpostgres.com;
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] RM6062.patch (3.4K, 3-RM6062.patch)
download | inline diff:
diff --git a/.gitignore b/.gitignore
index 50274f4d9..31b8d65a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,4 +51,8 @@ auditjs.html
auditpy.txt
/venv/
.scannerwork/
-web/coverage/
\ No newline at end of file
+web/coverage/
+web/.coverage
+web/regression/.coverage
+web/regression/covhtml/
+web/regression/htmlcov/
diff --git a/web/regression/README b/web/regression/README
index a17bd955d..c52ef9478 100644
--- a/web/regression/README
+++ b/web/regression/README
@@ -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'
-
-- 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.
+ run `coverage run ./runtests.py --exclude feature_tests --pkg browser.server_groups.servers.tests`
+
+- 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:
diff --git a/web/regression/runtests.py b/web/regression/runtests.py
index 6b1d3171e..a62358fac 100644
--- a/web/regression/runtests.py
+++ b/web/regression/runtests.py
@@ -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
view thread (2+ 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: [pgAdmin[RM6062] Code coverage does not cover function or class definitions
In-Reply-To: <CAM9w-_=gmiWOhSDegMScZV1SX8FhFs6n7CRHE4b4D10B7bBpgA@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