(tmp_path)
| 13 | |
| 14 | |
| 15 | def test_pyplot_up_to_date(tmp_path): |
| 16 | pytest.importorskip("black", minversion="24.1") |
| 17 | |
| 18 | gen_script = Path(mpl.__file__).parents[2] / "tools/boilerplate.py" |
| 19 | if not gen_script.exists(): |
| 20 | pytest.skip("boilerplate.py not found") |
| 21 | orig_contents = Path(plt.__file__).read_text() |
| 22 | plt_file = tmp_path / 'pyplot.py' |
| 23 | plt_file.write_text(orig_contents, 'utf-8') |
| 24 | |
| 25 | subprocess_run_for_testing( |
| 26 | [sys.executable, str(gen_script), str(plt_file)], |
| 27 | check=True) |
| 28 | new_contents = plt_file.read_text('utf-8') |
| 29 | |
| 30 | if orig_contents != new_contents: |
| 31 | diff_msg = '\n'.join( |
| 32 | difflib.unified_diff( |
| 33 | orig_contents.split('\n'), new_contents.split('\n'), |
| 34 | fromfile='found pyplot.py', |
| 35 | tofile='expected pyplot.py', |
| 36 | n=0, lineterm='')) |
| 37 | pytest.fail( |
| 38 | "pyplot.py is not up-to-date. Please run " |
| 39 | "'python tools/boilerplate.py' to update pyplot.py. " |
| 40 | "This needs to be done from an environment where your " |
| 41 | "current working copy is installed (e.g. 'pip install -e'd). " |
| 42 | "Here is a diff of unexpected differences:\n%s" % diff_msg |
| 43 | ) |
| 44 | |
| 45 | |
| 46 | def test_copy_docstring_and_deprecators(recwarn): |
nothing calls this directly
no test coverage detected
searching dependent graphs…