MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / run

Method run

lib/sqlalchemy/testing/fixtures/mypy.py:76–111  ·  view source on GitHub ↗
(path, use_plugin=False, use_cachedir=None)

Source from the content-addressed store, hash-verified

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

Callers 2

_run_coroutine_functionFunction · 0.45
unpickle_in_subprocessFunction · 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