diff --git a/cases/smoke/basic/screenshot32/new_script/conftest.py b/cases/smoke/basic/screenshot32/new_script/conftest.py index 798bce2a7098e39d7bb4c8b37ed940363d1d7699..fb6fdc96c41f2af13f938ce102c8f0379fd99b2a 100644 --- a/cases/smoke/basic/screenshot32/new_script/conftest.py +++ b/cases/smoke/basic/screenshot32/new_script/conftest.py @@ -21,7 +21,7 @@ def device(request): @pytest.fixture(scope='module') def setup_teardown(request, device): - # logging.info('setup--------') + logging.info('--------------setup--------------') current_case = os.path.basename(request.path)[:-3] # 日志截图等保存路径 device.report_path = os.path.realpath(os.path.dirname(request.config.option.htmlpath)) @@ -29,7 +29,7 @@ def setup_teardown(request, device): device.resource_path = os.path.join(os.path.dirname(__file__), 'resource') os.makedirs(device.report_path, exist_ok=True) # device.rm_faultlog() - # device.start_hilog() + device.start_hilog() device.wakeup() device.set_power_mode() device.set_screen_timeout() @@ -41,9 +41,9 @@ def setup_teardown(request, device): yield - # logging.info('后置操作') + logging.info('--------------teardown--------------') device.go_home() logging.info('clear recent task') device.clear_recent_task() device.clean_app_data(request.param) - # device.stop_and_collect_hilog() + device.stop_and_collect_hilog('{}.tar'.format(current_case)) diff --git a/cases/smoke/basic/screenshot32/new_script/utils/device.py b/cases/smoke/basic/screenshot32/new_script/utils/device.py index 056113516658b479510a989121f8be4f327f46ed..cddf6e6ee601aef1dea00e63334e367119c95b07 100644 --- a/cases/smoke/basic/screenshot32/new_script/utils/device.py +++ b/cases/smoke/basic/screenshot32/new_script/utils/device.py @@ -420,10 +420,11 @@ class Device: self.hdc_shell('hilog -w stop;hilog -w clear') self.hdc_shell('hilog -r;hilog -b INFO;hilog -w start -l 10M -n 1000') - def stop_and_collect_hilog(self, local_dir=''): + def stop_and_collect_hilog(self, local_file=''): # logging.info('停止并收集hilog') self.hdc_shell('hilog -w stop') - self.hdc_file_recv('/data/log/hilog/', local_dir) + self.hdc_shell(f'cd /data/log/hilog && tar -cf {local_file} *') + self.hdc_file_recv(f'/data/log/hilog/{local_file}') def unlock(self): """