mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
tools: Use root-based absolute import for tools.lib, etc.
Mypy can’t follow absolute imports based on directories other than the root. This was hiding some type errors due to ignore_missing_imports. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
7d71a1a31a
commit
684dad8145
@@ -1,10 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# check for the venv
|
||||
from lib import sanity_check
|
||||
|
||||
sanity_check.check_venv(__file__)
|
||||
|
||||
import argparse
|
||||
import contextlib
|
||||
import glob
|
||||
@@ -16,6 +11,15 @@ import tempfile
|
||||
from typing import Iterator, List
|
||||
from unittest import mock
|
||||
|
||||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
os.chdir(os.path.dirname(TOOLS_DIR))
|
||||
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
||||
|
||||
# check for the venv
|
||||
from tools.lib import sanity_check
|
||||
|
||||
sanity_check.check_venv(__file__)
|
||||
|
||||
import django
|
||||
import orjson
|
||||
import responses
|
||||
@@ -185,10 +189,6 @@ class ZulipInternetBlockedError(Exception):
|
||||
|
||||
|
||||
def main() -> None:
|
||||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
os.chdir(os.path.dirname(TOOLS_DIR))
|
||||
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
||||
|
||||
default_parallel = os.cpu_count()
|
||||
|
||||
# Remove proxy settings for running backend tests
|
||||
|
||||
Reference in New Issue
Block a user