From 5ac45ae13cb685a1b35ecb82a4ba56d0f5f83ab9 Mon Sep 17 00:00:00 2001 From: Sean McCann Date: Fri, 19 Apr 2024 15:58:52 +1200 Subject: [PATCH] removed previous code causing an error with testing. --- QGIS-AIMS-Plugin/test/run_tests.py | 59 +----------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) diff --git a/QGIS-AIMS-Plugin/test/run_tests.py b/QGIS-AIMS-Plugin/test/run_tests.py index 06580ec..e1bad14 100644 --- a/QGIS-AIMS-Plugin/test/run_tests.py +++ b/QGIS-AIMS-Plugin/test/run_tests.py @@ -17,7 +17,6 @@ from console.console_output import writeOut -print(f'\n\RUN_TESTS.PY SUCCESSFULLY ENTERED. Interface: {iface} is a QgisInterface: {isinstance(iface, QgisInterface)}') if iface is None: sys.exit("Must be run from inside QGIS") @@ -27,17 +26,13 @@ def _write(self, m): sys.__stdout__.write(m) writeOut.write = _write -print('\n\RUN_TESTS.PY SUCCESSFULLY SET WRITOUT.WRITE TO _WRITE') def run_tests(): - print('\n\RUN_TESTS.PY SUCCESSFULLY ENTERED RUN_TESTS FUNCTION') app = QgsApplication.instance() - print(f'\n\RUN_TESTS.PY SUCCESSFULLY ASSIGNED APPLICATION INSTANCE TO: {app} -- Is Correct Type: {isinstance(app, QgsApplication)}') try: test_module_name = os.environ["QGIS_TEST_MODULE"] test_class_name = os.environ["QGIS_TEST_CLASS"] test_name = os.environ["QGIS_TEST_NAME"] - print(f'RUN_TESTS.PY (36) -- Environent Variables: {test_module_name} -- {test_class_name} -- {test_name}') if test_module_name != "" and test_class_name != "" and test_name != "": test_suite = unittest.TestLoader().loadTestsFromName(f"{test_class_name}.{test_name}", importlib.import_module(test_module_name)) elif test_module_name != "" and test_class_name != "": @@ -54,56 +49,4 @@ def run_tests(): sys.path.append(QDir.current().path()) # Add current working dir to the python path -print(f'\n\RUN_TESTS.PY SUCCESSFULLY ADDED PATH: {QDir.current().path()} TO SYS.PATH') -iface.initializationCompleted.connect(run_tests) - - - - - - - - - - - - - - - - - - -''' -v.0.0.2 - -QGIS-AIMS-Plugin - run_tests - -Copyright 2024 Crown copyright (c) -Land Information New Zealand and the New Zealand Government. -All rights reserved - -This program is released under the terms of the new BSD license. See the -LICENSE file for more information. - -Test Suite runner based on existing example in the linz-data-importer repo - -Created on 29/10/2015 - -@author: smccann -''' - -import os -import sys -import unittest - -__location__ = os.path.dirname(os.path.realpath(__file__)) - - -def run_test_modules(): - """ - Loops through all TestCase instances in a test folder to find - unique test modules - """ - test_suite = unittest.TestLoader().discover(__location__, pattern="*_Test.py") - unittest.TextTestRunner(verbosity=3, stream=sys.stdout).run(test_suite) \ No newline at end of file +iface.initializationCompleted.connect(run_tests) \ No newline at end of file