test: add test case for miot mdns and network

This commit is contained in:
topsworld
2024-12-16 09:18:36 +08:00
committed by Lucien Hsiao
parent ad7f9eb610
commit 9d95379f83
4 changed files with 60 additions and 9 deletions

View File

@ -77,15 +77,12 @@ async def test_spec_random_parse_async(test_cache_path, test_lang):
# get local cache
storage = MIoTStorage(test_cache_path)
# local_urns = storage.get_names(domain='miot_specs', type_=dict)
# print('local urns, %s', local_urns)
spec_parser = MIoTSpecParser(lang=test_lang, storage=storage)
await spec_parser.init_async()
start: int = time.time()*1000
start_ts: int = time.time()*1000
for index in test_urn_index:
urn: str = test_urns[int(index)]
result = await spec_parser.parse(urn=urn, skip_cache=True)
assert result is not None
# print('parse, %s, %s\n', urn, json.dumps(result.dump()))
end: int = time.time()*1000
print(f'takes time, {test_count}, {end-start}')
end_ts: int = time.time()*1000
print(f'takes time, {test_count}, {end_ts-start_ts}')