MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / run

Method run

lib/sqlalchemy/testing/fixtures/mypy.py:70–98  ·  view source on GitHub ↗
(path, use_cachedir=None)

Source from the content-addressed store, hash-verified

68 from mypy import api
69
70 def run(path, use_cachedir=None):
71 if use_cachedir is None:
72 use_cachedir = cachedir
73 args = [
74 "--strict",
75 "--raise-exceptions",
76 "--cache-dir",
77 use_cachedir,
78 "--config-file",
79 os.path.join(use_cachedir, "plain_mypy_config.cfg"),
80 ]
81
82 # mypy as of 0.990 is more aggressively blocking messaging
83 # for paths that are in sys.path, and as pytest puts currdir,
84 # test/ etc in sys.path, just copy the source file to the
85 # tempdir we are working in so that we don't have to try to
86 # manipulate sys.path and/or guess what mypy is doing
87 filename = os.path.basename(path)
88 test_program = os.path.join(use_cachedir, filename)
89 if path != test_program:
90 shutil.copyfile(path, test_program)
91 args.append(test_program)
92
93 # I set this locally but for the suite here needs to be
94 # disabled
95 os.environ.pop("MYPY_FORCE_COLOR", None)
96
97 stdout, stderr, exitcode = api.run(args)
98 return stdout, stderr, exitcode
99
100 return run
101

Callers 1

_run_coroutine_functionFunction · 0.45

Calls 5

_collect_messagesMethod · 0.95
_check_outputMethod · 0.95
joinMethod · 0.45
appendMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected