Skip to content

Commit e857bd3

Browse files
don't run mypy on nonexistent samples dir, fix pip install for tox (Azure#31738)
1 parent 98a94c4 commit e857bd3

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

eng/tox/run_mypy.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,25 @@
7676
f"Package {package_name} opts-out of mypy check on samples."
7777
)
7878
else:
79-
sample_code = [
80-
*commands,
81-
"--check-untyped-defs",
82-
"--follow-imports=silent",
83-
os.path.join(args.target_package, "samples")
84-
]
85-
try:
79+
# check if samples dir exists, if not, skip sample code check
80+
if not os.path.exists(os.path.join(args.target_package, "samples")):
8681
logging.info(
87-
f"Running mypy commands on sample code: {sample_code}"
82+
f"Package {package_name} does not have a samples directory."
8883
)
89-
check_call(sample_code)
90-
except CalledProcessError as sample_err:
91-
sample_code_error = sample_err
84+
else:
85+
sample_code = [
86+
*commands,
87+
"--check-untyped-defs",
88+
"--follow-imports=silent",
89+
os.path.join(args.target_package, "samples")
90+
]
91+
try:
92+
logging.info(
93+
f"Running mypy commands on sample code: {sample_code}"
94+
)
95+
check_call(sample_code)
96+
except CalledProcessError as sample_err:
97+
sample_code_error = sample_err
9298

9399
if args.next and in_ci() and is_check_enabled(args.target_package, "mypy") and not is_typing_ignored(package_name):
94100
if src_code_error or sample_code_error:

tools/azure-sdk-tools/gh_tools/vnext_issue_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def create_vnext_issue(package_name: str, check_type: Literal["mypy", "pylint",
114114
f"\n**{check_type.capitalize()} errors:** [Link to build ({today.strftime('%Y-%m-%d')})]({build_link})"
115115
f"\n**How to fix:** Run the `next-{check_type}` tox command at the library package-level and resolve "
116116
f"the {error_type} errors.\n"
117-
f"1) `../{package_name}>pip install tox<5`\n"
117+
f"1) `../{package_name}>pip install \"tox<5\"`\n"
118118
f"2) `../{package_name}>tox run -e next-{check_type} -c ../../../eng/tox/tox.ini --root .`\n\n"
119119
f"See the {guide_link} for more information."
120120
)

0 commit comments

Comments
 (0)