(path, use_cachedir=None)
| 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 |
no test coverage detected