def setUp(self): self.app = 'vlc' self.install_command = f'apt-get -y install {self.app}' self.remove_command = f'sudo apt-get -y remove {self.app}' self.single = 'ItemChanged' self.parse_flgs = ('string "deleted"', 'string "vlc"') self.passwd = self.get_data('passwd') self.Step(f'步骤1:检查使用存在{self.app}应用,若不存在先安装') if not is_in_apps(self.app): self.Step(f'安装{self.app}') logging.info( root_execute_command_by_stdin(self.install_command, self.passwd)) time.sleep(5)
def setUp(self): self.app = 'vlc' self.install_command = f'apt-get -y install {self.app}' self.remove_command = f'sudo apt-get -y remove {self.app}' self.single = 'StatusSaved' self.parse_flgs = ('string "/usr/share/applications"',) self.passwd = self.get_data('passwd') self.Step(f'步骤1:安装{self.app}') logging.info(root_execute_command_by_stdin(self.install_command, self.passwd)) time.sleep(5) self.Step(f"步骤2:使用dbus-monitor命令监控com.deepin.daemon.Apps.LaunchedRecorder") self.dbus_monitor = start_monitor_signal_for_system(appsLaunchedRecorder.IFACE_NAME, appsLaunchedRecorder.DBUS_PATH, member=self.single) time.sleep(5)
def test_step(self): self.Step('步骤2:使用dbus-monitor命令监控com.deepin.dde.daemon.Launcher') dbus_monitor = start_monitor_signal(member=self.single) time.sleep(2) self.Step(f'步骤3:卸载{self.app}') logging.info( root_execute_command_by_stdin(self.remove_command, self.passwd)) time.sleep(2) self.Step( '''步骤4:解析dbus-monitor结果,是否监控到ItemChanged信号,判断'string "deleted"'和'string "vlc"'是否在返回值中''' ) stop_monitor_signal(dbus_monitor) time.sleep(1) result = itemChanged(dbus_monitor, *self.parse_flgs) assert result
def test_step(self): self.Step(f"步骤2:卸载{self.app}应用") logging.info(root_execute_command_by_stdin(self.remove_command, self.passwd)) time.sleep(5) appsLaunchedRecorder.statusSaved(self.dbus_monitor, *self.parse_flgs)
def tearDown(self): self.Step(f'tearDown: 卸载{self.app}') logging.info( root_execute_command_by_stdin(self.remove_command, self.passwd)) time.sleep(5)
def test_step(self): self.Step(f"步骤2:卸载{self.app}应用") logging.info( root_execute_command_by_stdin(self.remove_command, self.passwd)) time.sleep(5) appsDesktopFileWatcher.event(self.dbus_monitor, *self.parse_flgs)