Add test for Router.get_valid_args, fix router code coverage encoding (#19797)

- Add test_get_valid_args in test_router_helper_utils.py to cover get_valid_args
- Use encoding='utf-8' in router_code_coverage.py for cross-platform file reads
This commit is contained in:
Alexsander Hamir
2026-01-26 10:14:58 -08:00
committed by GitHub
parent c0d6998384
commit 4a6dcf3012
2 changed files with 31 additions and 2 deletions
@@ -6,7 +6,7 @@ def get_function_names_from_file(file_path):
"""
Extracts all function names from a given Python file.
"""
with open(file_path, "r") as file:
with open(file_path, "r", encoding="utf-8") as file:
tree = ast.parse(file.read())
function_names = []
@@ -45,7 +45,7 @@ def get_all_functions_called_in_tests(base_dir):
if file.endswith(".py") and "router" in file.lower():
print("file: ", file)
file_path = os.path.join(root, file)
with open(file_path, "r") as f:
with open(file_path, "r", encoding="utf-8") as f:
try:
tree = ast.parse(f.read())
except SyntaxError: