Skip to content

Commit 282b579

Browse files
committed
Conditionally fix MacOS tmp path
1 parent 8e6125f commit 282b579

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

mypy/test/test_config_parser.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,12 @@ def set_strict_flags() -> None:
174174
assert strict_option_set is True
175175
assert options.ignore_missing_imports_per_module is True
176176
assert options.config_file == str(pyproject.name)
177-
# MacOS has some odd symlinks for tmp folder, resolve them to get the actual values
178-
assert os.environ["MYPY_CONFIG_FILE_DIR"] == os.path.realpath(pyproject.parent)
177+
if os.path.realpath(pyproject.parent).startswith("/private"):
178+
# MacOS has some odd symlinks for tmp folder, resolve them to get the actual values
179+
expected_path = os.path.realpath(pyproject.parent)
180+
else:
181+
expected_path = str(pyproject.parent)
182+
assert os.environ["MYPY_CONFIG_FILE_DIR"] == expected_path
179183

180184
assert options.per_module_options["c"] == {
181185
"disable_error_code": [],
@@ -205,11 +209,18 @@ def test_extend_cyclic(self) -> None:
205209
stderr = io.StringIO()
206210
parse_config_file(options, lambda: None, None, stdout, stderr)
207211

208-
# MacOS has some odd symlinks for tmp folder, resolve them to get the actual values
212+
if os.path.realpath(pyproject).startswith("/private"):
213+
# MacOS has some odd symlinks for tmp folder, resolve them to get the actual values
214+
expected_pyproject = os.path.realpath(pyproject)
215+
expected_ini = os.path.realpath(ini)
216+
else:
217+
expected_pyproject = str(pyproject)
218+
expected_ini = str(ini)
219+
209220
assert stdout.getvalue() == ""
210221
assert stderr.getvalue() == (
211-
f"Circular extend detected: {os.path.realpath(pyproject)}\n"
212-
f"../pyproject.toml is not a valid path to extend from {os.path.realpath(ini)}\n"
222+
f"Circular extend detected: {expected_pyproject}\n"
223+
f"../pyproject.toml is not a valid path to extend from {expected_ini}\n"
213224
)
214225

215226
def test_extend_strict_override(self) -> None:

0 commit comments

Comments
 (0)