Skip to content

Commit 24cdb8d

Browse files
only do verifytypes completeness score comparison against main if tox run in CI (#33679)
1 parent 85b9168 commit 24cdb8d

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

eng/tox/run_verifytypes.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -140,21 +140,22 @@ def get_type_complete_score(commands: typing.List[str], check_pytyped: bool = Fa
140140
except subprocess.CalledProcessError:
141141
pass # we don't fail on verifytypes, only if type completeness score worsens from main
142142

143-
# get type completeness score from main
144-
logging.info(
145-
"Getting the type completeness score from the code in main..."
146-
)
147-
install_from_main(setup_path)
148-
score_from_main = get_type_complete_score(commands)
149-
150-
score_from_main_rounded = round(score_from_main * 100, 1)
151-
score_from_current_rounded = round(score_from_current * 100, 1)
152-
print("\n-----Type completeness score comparison-----\n")
153-
print(f"Score in main: {score_from_main_rounded}%")
154-
# Give a 5% buffer for type completeness score to decrease
155-
if score_from_current_rounded < score_from_main_rounded - 5:
156-
print(
157-
f"\nERROR: The type completeness score of {package_name} has significantly decreased compared to the score in main. "
158-
f"See the above output for areas to improve. See https://aka.ms/python/typing-guide for information."
143+
if in_ci():
144+
# get type completeness score from main
145+
logging.info(
146+
"Getting the type completeness score from the code in main..."
159147
)
160-
exit(1)
148+
install_from_main(setup_path)
149+
score_from_main = get_type_complete_score(commands)
150+
151+
score_from_main_rounded = round(score_from_main * 100, 1)
152+
score_from_current_rounded = round(score_from_current * 100, 1)
153+
print("\n-----Type completeness score comparison-----\n")
154+
print(f"Score in main: {score_from_main_rounded}%")
155+
# Give a 5% buffer for type completeness score to decrease
156+
if score_from_current_rounded < score_from_main_rounded - 5:
157+
print(
158+
f"\nERROR: The type completeness score of {package_name} has significantly decreased compared to the score in main. "
159+
f"See the above output for areas to improve. See https://aka.ms/python/typing-guide for information."
160+
)
161+
exit(1)

0 commit comments

Comments
 (0)