mypy: Use python3 type syntax in test-backend.

This commit is contained in:
Raymond Akornor 2019-03-15 14:37:42 +00:00 committed by Tim Abbott
parent 193de819b8
commit ea112828dc
1 changed files with 4 additions and 8 deletions

View File

@ -145,8 +145,7 @@ enforce_fully_covered = sorted(target_fully_covered - not_yet_fully_covered)
FAILED_TEST_PATH = 'var/last_test_failure.json'
def get_failed_tests():
# type: () -> List[str]
def get_failed_tests() -> List[str]:
try:
with open(FAILED_TEST_PATH, 'r') as f:
return ujson.load(f)
@ -154,14 +153,12 @@ def get_failed_tests():
print("var/last_test_failure.json doesn't exist; running all tests.")
return []
def write_failed_tests(failed_tests):
# type: (List[str]) -> None
def write_failed_tests(failed_tests: List[str]) -> None:
if failed_tests:
with open(FAILED_TEST_PATH, 'w') as f:
ujson.dump(failed_tests, f)
def block_internet():
# type: () -> None
def block_internet() -> None:
# We are blocking internet currently by assuming mostly any test would use
# httplib2 to access internet.
requests_orig = requests.request
@ -300,8 +297,7 @@ def main() -> None:
for i, suite in enumerate(args):
args[i] = suite.rstrip('/').replace("/", ".")
def rewrite_arguments(search_key):
# type: (str) -> None
def rewrite_arguments(search_key: str) -> None:
for root, dirs, files_names in os.walk(zerver_test_dir, topdown=False):
for file_name in files_names:
# Check for files starting with alphanumeric characters and ending with '.py'