Skip to content

Commit

Permalink
removed previous code causing an error with testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean-McCann-HG committed Apr 19, 2024
1 parent 16e7fa3 commit 5ac45ae
Showing 1 changed file with 1 addition and 58 deletions.
59 changes: 1 addition & 58 deletions QGIS-AIMS-Plugin/test/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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 != "":
Expand All @@ -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)
iface.initializationCompleted.connect(run_tests)

0 comments on commit 5ac45ae

Please sign in to comment.