diff --git a/Ccs/ccs.py b/Ccs/ccs.py index c22b0c130dd12aaf021c6fc9762b88590c08eca6..3220f5d93acaf34550dcc6c0d2dc13834573ef76 100755 --- a/Ccs/ccs.py +++ b/Ccs/ccs.py @@ -45,7 +45,7 @@ if len(sys.argv) > 1: if not fname.startswith('-'): win.open_file(fname) else: - win.open_file('getting_started.py') + win.open_file(os.path.join(confignator.get_option('paths', 'ccs'), 'getting_started.py')) Bus_Name = cfg.get('ccs-dbus_names', 'editor') diff --git a/Ccs/poolview_sql.py b/Ccs/poolview_sql.py index 733c57f6e1a9cc089b05a3a825d3b66b17534a2d..72c456bc52cc3fc2954d0340034711546f73382f 100644 --- a/Ccs/poolview_sql.py +++ b/Ccs/poolview_sql.py @@ -3224,8 +3224,8 @@ class TMPoolView(Gtk.Window): if pool_name != self.active_pool_info.pool_name: return False - if not self.active_pool_info.live: - return False + #if not self.active_pool_info.live: + # return False if cfl.is_open('poolmanager', cfl.communication['poolmanager']): poolmgr = cfl.dbus_connection('poolmanager', cfl.communication['poolmanager']) @@ -3234,7 +3234,7 @@ class TMPoolView(Gtk.Window): # Get value of dict connections, with key self.active... and key recording, True to get pool_connection_recording = poolmgr.Dictionaries('connections', self.active_pool_info.pool_name, 'recording', - True, ignore_reply=True) + True) #pool_connection = poolmgr.Dictionaries('connections', self.active_pool_info.pool_name) if pool_connection_recording: #if self.pool.connections[self.active_pool_info.pool_name]['recording']: diff --git a/Ccs/pus_datapool.py b/Ccs/pus_datapool.py index 9c91f2b40db722df5186890ba650987c8dd4cd8e..591c5d3a9605d443397ce67a2272ebdd67378791 100644 --- a/Ccs/pus_datapool.py +++ b/Ccs/pus_datapool.py @@ -1871,11 +1871,17 @@ class DatapoolManager: nr = '' editor.Functions('_to_console_via_socket', 'del(pmgr' + str(nr) + ')') + #if cfl.is_open('poolviewer', cfl.communication['poolviewer']): + # pv = cfl.dbus_connection('poolviewer', cfl.communication['poolviewer']) + # # Ignore_reply = True not recommended, but it is checked here that it is working + # pv.Functions('stop_all_recording', ignore_reply=True) # Tell poolviewer that pool is no longer live + # time.sleep(1) + for pool in self.loaded_pools.keys(): + self.disconnect(self.loaded_pools[pool].pool_name) + print(self.loaded_pools) + print(self.connections) if cfl.is_open('poolviewer', cfl.communication['poolviewer']): - pv = cfl.dbus_connection('poolviewer', cfl.communication['poolviewer']) - # Ignore_reply = True not recommended, but it is checked here that it is working - pv.Functions('stop_all_recording', ignore_reply=True) # Tell poolviewer that pool is no longer live - time.sleep(1) + self.small_refresh_function() try: self.update_all_connections_quit() @@ -1885,20 +1891,22 @@ class DatapoolManager: Gtk.main_quit() return True + def small_refresh_function(self): + return + def update_all_connections_quit(self): ''' Tells all running applications that it is not longer availabe and suggests another main communicatior if one is available :return: ''' - our_con = [] # All connections to running applications without communications from the same applications as this my_con = [] # All connections to same applications as this for service in dbus.SessionBus().list_names(): if service.split('.')[1] in self.cfg['ccs-dbus_names']: # Check if connection belongs to CCS if service == self.my_bus_name: # If own allplication do nothing continue - self.logger.debug(type(service)) + #self.logger.debug(type(service)) conn = cfl.dbus_connection(service.split('.')[1], service[-1]) if cfl.Variables(conn,'main_instance') == self.main_instance: # Check if running in same project if service.startswith(self.my_bus_name[:-1]): # Check if it is same application type diff --git a/Tst/confignator/confignator/config.py b/Tst/confignator/confignator/config.py index c897aa3921dd1c198061a1fd39ae01a7e52ba265..251f53c056fa39d1951085926a66ff96454486b9 100755 --- a/Tst/confignator/confignator/config.py +++ b/Tst/confignator/confignator/config.py @@ -42,8 +42,12 @@ import logging import logging.handlers # hardcoded stuff +# INFO: path to confignator_cfg, has to be "../build..." if started with pycharm and confignator is marked as root +# directory, otherwhise it has to be only "confignator.cfg". This is because normally the config file of the installed +# python confignator package would be used (".local/lib.../confignator"), but if marked as root in pycharm, it first +# searches for the config file in the confignator folder, where the cfg is in the given path... cfg = configparser.ConfigParser() -confignator_cfg = os.path.join(os.path.dirname(__file__), 'confignator.cfg') +confignator_cfg = os.path.join(os.path.dirname(__file__), '../build/lib/confignator/confignator.cfg') cfg.read(confignator_cfg) basic_config = cfg.get('confignator-paths', 'basic-cfg') docu = cfg.get('confignator-paths', 'docu') @@ -385,7 +389,7 @@ class Config(configparser.ConfigParser): # check if a interpolation syntax exists in the old value and take over into the new value raw_value_before = self.get(section, option, raw=True) found = raw_value_before.find('${') - if found is not -1: + if found != -1: try: closing_bracket = raw_value_before.find('}') inter_syntax = raw_value_before[found:closing_bracket+1] diff --git a/Tst/progress_view/progress_view.py b/Tst/progress_view/progress_view.py index afbd779198177f267a4e3016d81781a3af149b3c..343d702cb56a9fd4dfc85e7fa23b4a1fd45c18a2 100644 --- a/Tst/progress_view/progress_view.py +++ b/Tst/progress_view/progress_view.py @@ -18,6 +18,7 @@ import time import data_model import json import toolbox +import generator # create a logger log_file_path = confignator.get_option(section='progress-viewer-logging', option='log-file-path') @@ -264,7 +265,7 @@ class TestProgressView(Gtk.ApplicationWindow): # expand all entries self.view.expand_all() - self.refresh_rate = 5 + self.refresh_rate = 1 self.refresh_worker() # for styling the application with CSS @@ -303,29 +304,62 @@ class TestProgressView(Gtk.ApplicationWindow): if response == Gtk.ResponseType.OK: file_selected = dialog.get_filename() # ToDo: get the path for all 3 (json, cmd, vrc) and load them + self.open_test_files(None, self.get_log_file_paths_from_json_file_name(file_selected)) elif response == Gtk.ResponseType.CANCEL: pass dialog.destroy() - def open_test_files(self, simple_action, paths, *args): - logger.debug('Opening files... ') - self.path_json = paths['json_file_path'] - self.text_path_json_btn.set_file(Gio.File.new_for_path(self.path_json)) + def get_log_file_paths_from_json_file_name(self, filename): + from testlib import testing_logger + paths = {} + try: + current_file_name = os.path.basename(filename) + path_test_specs = confignator.get_option(section='tst-paths', option='tst_products') + path_test_runs = confignator.get_option(section='tst-logging', option='test_run') - self.path_cmd = paths['cmd_log_file_path'] - self.text_path_cmd_btn.set_file(Gio.File.new_for_path(self.path_cmd)) - self.monitor_cmd = Gio.File.new_for_path(self.path_cmd).monitor_file(Gio.FileMonitorFlags.NONE, None) - self.monitor_cmd.set_rate_limit(100) - self.monitor_cmd.connect('changed', self.file_cmd_changed) + json_file_path = os.path.join(path_test_specs, current_file_name) + paths['json_file_path'] = json_file_path - self.path_vrc = paths['vrc_log_file_path'] - self.text_path_vrc_btn.set_file(Gio.File.new_for_path(self.path_vrc)) - self.monitor_vrc = Gio.File.new_for_path(self.path_vrc).monitor_file(Gio.FileMonitorFlags.NONE, None) - self.monitor_vrc.set_rate_limit(100) - self.monitor_vrc.connect('changed', self.file_vrc_changed) + name = generator.strip_file_extension(current_file_name) + cmd_log_file_path = os.path.join(path_test_runs, name + testing_logger.cmd_log_auxiliary) + paths['cmd_log_file_path'] = cmd_log_file_path + + vrc_log_file_path = os.path.join(path_test_runs, name + testing_logger.vrc_log_auxiliary) + paths['vrc_log_file_path'] = vrc_log_file_path + except Exception as e: + self.logger.info('Json or Log Files could not be found') + return '' + return paths + + def open_test_files(self, simple_action, paths, *args): + logger.debug('Opening files... ') + try: + self.path_json = paths['json_file_path'] + self.text_path_json_btn.set_file(Gio.File.new_for_path(self.path_json)) + except: + logger.debug('JSon File could not be opened') + + try: + self.path_cmd = paths['cmd_log_file_path'] + self.text_path_cmd_btn.set_file(Gio.File.new_for_path(self.path_cmd)) + self.monitor_cmd = Gio.File.new_for_path(self.path_cmd).monitor_file(Gio.FileMonitorFlags.NONE, None) + self.monitor_cmd.set_rate_limit(100) + self.monitor_cmd.connect('changed', self.file_cmd_changed) + except: + logger.debug('Commond log File could not be opened') + + try: + self.path_vrc = paths['vrc_log_file_path'] + self.text_path_vrc_btn.set_file(Gio.File.new_for_path(self.path_vrc)) + self.monitor_vrc = Gio.File.new_for_path(self.path_vrc).monitor_file(Gio.FileMonitorFlags.NONE, None) + self.monitor_vrc.set_rate_limit(100) + self.monitor_vrc.connect('changed', self.file_vrc_changed) + except: + logger.debug('Verification log File could not be opened') self.on_reload_all() self.on_expand_all_rows() + self.refresh_worker() def add_info_bar(self, message_type, message): """ @@ -439,13 +473,10 @@ class TestProgressView(Gtk.ApplicationWindow): def on_reload_all(self, *args): if self.path_json: self.load_json(self.path_json) - print(1) if self.path_cmd: self.load_cmd(self.path_cmd) - print(2) if self.path_vrc: self.load_vrc(self.path_vrc) - print(3) def on_clear_cmd_log(self, *args): diff --git a/Tst/testing_library/testlib/report.py b/Tst/testing_library/testlib/report.py index d0cdc4d85bda0631fd3d231c17ba0d10ddaf7844..ef1dd48498f5654f2342d5b768944b991a6da1db 100644 --- a/Tst/testing_library/testlib/report.py +++ b/Tst/testing_library/testlib/report.py @@ -259,3 +259,14 @@ def write_precondition_outcome(result): logger.info('Preconditions are fulfilled.\n') else: logger.warning('Preconditions are NOT fulfilled.\n') + +def write_postcondition_outcome(result): + """ + Logs the outcome of the establish_postconditions function in a test script. + :param result: bool + True if all postcondition could be established successfully + """ + if result is True: + logger.info('Postconditions are fulfilled.\n') + else: + logger.warning('Postconditions are NOT fulfilled.\n') diff --git a/Tst/tst/tst.py b/Tst/tst/tst.py index 6dcd37ee6286c2ae6e3e6e2847a6c082064d1bf7..162836ae71fa3182ec3c794f2fba03782506eb44 100755 --- a/Tst/tst/tst.py +++ b/Tst/tst/tst.py @@ -907,8 +907,6 @@ def run(): dbus.validate_bus_name(bus_name) applica = TstApp(bus_name, Gio.ApplicationFlags.FLAGS_NONE, logger=logger) - print(sys.path) - print(view) applica.run()