feat: add user-agent (#1804)

This commit is contained in:
Li Shuzhen
2026-09-28 13:59:57 +08:00
committed by GitHub
parent a253918896
commit 7201cf2277
6 changed files with 77 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ import logging
import random
import shutil
import pytest
from os import path, makedirs
from os import path, makedirs, remove
from uuid import uuid4
TEST_ROOT_PATH: str = path.dirname(path.abspath(__file__))
@@ -57,6 +57,12 @@ def load_py_file():
file_name),
path.join(TEST_FILES_PATH, file_name))
_LOGGER.info('\nloaded test py files, %s', file_list)
# Copy manifest.json to test folder (parent of miot/)
shutil.copyfile(
path.join(
TEST_ROOT_PATH, '../custom_components/xiaomi_home/manifest.json'),
path.join(TEST_ROOT_PATH, 'manifest.json'))
_LOGGER.info('loaded manifest.json')
# Copy spec files to test folder
shutil.copytree(
src=path.join(
@@ -89,6 +95,11 @@ def load_py_file():
shutil.rmtree(TEST_FILES_PATH)
print('\nremoved test files, ', TEST_FILES_PATH)
manifest_path = path.join(TEST_ROOT_PATH, 'manifest.json')
if path.exists(manifest_path):
remove(manifest_path)
print('removed test manifest.json, ', manifest_path)
if path.exists(TEST_CACHE_PATH):
shutil.rmtree(TEST_CACHE_PATH)
print('removed test cache, ', TEST_CACHE_PATH)