From 3b4e4d2b621cf69158dd79cb7b796994e1683642 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Thu, 5 Jan 2023 20:08:23 +0000 Subject: [PATCH] Make `requirements-ci.txt` reading cwd independent (#91771) Discovered while running `test_typing.py` locally Pull Request resolved: https://github.com/pytorch/pytorch/pull/91771 Approved by: https://github.com/huydhn, https://github.com/ZainRizvi --- mypy_plugins/check_mypy_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy_plugins/check_mypy_version.py b/mypy_plugins/check_mypy_version.py index a34b8683c98..0110232e566 100644 --- a/mypy_plugins/check_mypy_version.py +++ b/mypy_plugins/check_mypy_version.py @@ -9,7 +9,7 @@ def get_correct_mypy_version(): # there's probably a more elegant way to do this match, = re.finditer( r'mypy==(\d+(?:\.\d+)*)', - Path('.circleci/docker/requirements-ci.txt').read_text(), + (Path(__file__).parent.parent / '.circleci' / 'docker' / 'requirements-ci.txt').read_text(), ) version, = match.groups() return version