diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 13bfa81d9ffa..b20af9108bd0 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -225,6 +225,7 @@ def _get_version(): else: return setuptools_scm.get_version( root=root, + dist_name="matplotlib", version_scheme="release-branch-semver", local_scheme="node-and-date", fallback_version=_version.version, diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index 1474a67d28aa..8bb7ef9deb54 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -150,7 +150,15 @@ def test_pickle_load_from_subprocess(fig_test, fig_ref, tmp_path): proc = subprocess_run_helper( _pickle_load_subprocess, timeout=60, - extra_env={'PICKLE_FILE_PATH': str(fp), 'MPLBACKEND': 'Agg'} + extra_env={ + "PICKLE_FILE_PATH": str(fp), + "MPLBACKEND": "Agg", + # subprocess_run_helper will set SOURCE_DATE_EPOCH=0, so for a dirty tree, + # the version will have the date 19700101. As we aren't trying to test the + # version compatibility warning, force setuptools-scm to use the same + # version as us. + "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MATPLOTLIB": mpl.__version__, + }, ) loaded_fig = pickle.loads(ast.literal_eval(proc.stdout))