def runTest(): plugin_dir = pluginPath() plugins_dir = os.path.dirname(plugin_dir) # python path setting sys.path.append(plugins_dir) # initialize output directory initOutputDir() plugin_name = os.path.basename(plugin_dir) suite = unittest.TestLoader().discover(plugin_name + ".tests") unittest.TextTestRunner(verbosity=2).run(suite)
def test01_import(self): """import test""" plugin_dir = pluginPath() imported = 0 for package_dir in ["", "/objects", "/plugins/gsielevtile"]: for filename in os.listdir(plugin_dir + package_dir): if filename[-3:] != ".py" or filename == "__init__.py": continue module = "Qgis2threejs" if package_dir: module += "." + package_dir[1:].replace("/", ".") module += "." + filename[:-3] if module not in sys.modules: # print "load: " + module importlib.import_module(module) else: # print "reload: " + module # reload(sys.modules[module]) pass imported += 1 print "{0} modules imported".format(imported)
def test01_import(self): """import test""" plugin_dir = pluginPath() imported = 0 for package_dir in ["", "/objects", "/plugins/gsielevtile"]: for filename in os.listdir(plugin_dir + package_dir): if filename[-3:] != ".py" or filename == "__init__.py": continue module = "Qgis2threejs" if package_dir: module += "." + package_dir[1:].replace("/", ".") module += "." + filename[:-3] if module not in sys.modules: #print "load: " + module importlib.import_module(module) else: #print "reload: " + module #reload(sys.modules[module]) pass imported += 1 print "{0} modules imported".format(imported)
plugins_dir = os.path.dirname(plugin_dir) # python path setting sys.path.append(plugins_dir) # initialize output directory initOutputDir() plugin_name = os.path.basename(plugin_dir) suite = unittest.TestLoader().discover(plugin_name + ".tests") unittest.TextTestRunner(verbosity=2).run(suite) if __name__ == "__main__": gui_mode = True QGISAPP = QgsApplication(sys.argv, gui_mode) QGISAPP.initQgis() print "=" * 70 print QGISAPP.showSettings() print "=" * 70 # set up network disk cache manager = QgsNetworkAccessManager.instance() cache = QNetworkDiskCache(manager) cache.setCacheDirectory(pluginPath(os.path.join("tests", "cache"))) cache.setMaximumCacheSize(50 * 1024 * 1024) manager.setCache(cache) # run test! runTest()