mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	Generated by com2ann (slightly patched to avoid also converting assignment type annotations, which require Python 3.6), followed by some manual whitespace adjustment, and six fixes for runtime issues: - def __init__(self, token: Token, parent: Optional[Node]) -> None: + def __init__(self, token: Token, parent: "Optional[Node]") -> None: -def main(options: argparse.Namespace) -> NoReturn: +def main(options: argparse.Namespace) -> "NoReturn": -def fetch_request(url: str, callback: Any, **kwargs: Any) -> Generator[Callable[..., Any], Any, None]: +def fetch_request(url: str, callback: Any, **kwargs: Any) -> "Generator[Callable[..., Any], Any, None]": -def assert_server_running(server: subprocess.Popen[bytes], log_file: Optional[str]) -> None: +def assert_server_running(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> None: -def server_is_up(server: subprocess.Popen[bytes], log_file: Optional[str]) -> bool: +def server_is_up(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> bool: - method_kwarg_pairs: List[FuncKwargPair], + method_kwarg_pairs: "List[FuncKwargPair]", Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env python3
 | 
						|
 | 
						|
 | 
						|
import argparse
 | 
						|
import os
 | 
						|
import sys
 | 
						|
import unittest
 | 
						|
 | 
						|
# check for the venv
 | 
						|
from lib import sanity_check
 | 
						|
sanity_check.check_venv(__file__)
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
    parser = argparse.ArgumentParser()
 | 
						|
    parser.add_argument('--coverage', dest='coverage',
 | 
						|
                        action="store_true",
 | 
						|
                        default=False, help='compute test coverage')
 | 
						|
    args = parser.parse_args()
 | 
						|
 | 
						|
    def dir_join(dir1: str, dir2: str) -> str:
 | 
						|
        return os.path.abspath(os.path.join(dir1, dir2))
 | 
						|
 | 
						|
    tools_dir = os.path.dirname(os.path.abspath(__file__))
 | 
						|
    root_dir = dir_join(tools_dir, '..')
 | 
						|
    tools_test_dir = dir_join(tools_dir, 'tests')
 | 
						|
 | 
						|
    sys.path.insert(0, root_dir)
 | 
						|
 | 
						|
    loader = unittest.TestLoader()
 | 
						|
 | 
						|
    if args.coverage:
 | 
						|
        import coverage
 | 
						|
        cov = coverage.Coverage(branch=True, omit=["*/zulip-venv-cache/*", dir_join(tools_test_dir, "*")])
 | 
						|
        cov.start()
 | 
						|
 | 
						|
    suite = loader.discover(start_dir=tools_test_dir, top_level_dir=root_dir)
 | 
						|
    runner = unittest.TextTestRunner(verbosity=2)
 | 
						|
    result = runner.run(suite)
 | 
						|
    if result.errors or result.failures:
 | 
						|
        raise Exception('Test failed!')
 | 
						|
 | 
						|
    if args.coverage:
 | 
						|
        cov.stop()
 | 
						|
        cov.save()
 | 
						|
        cov.html_report(directory='var/tools_coverage')
 | 
						|
        print("HTML report saved to var/tools_coverage")
 | 
						|
 | 
						|
    print('SUCCESS')
 |