Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 16fad2e

Browse filesBrowse files
committed
TST: Fix test_pickle_load_from_subprocess in a dirty tree
For a ditry tree, `setuptools-scm` adds the date to the end of the version. This test runs a subprocess and `subprocess_run_helper` will set `SOURCE_DATE_EPOCH=0`, which forces the date to be 1970-01-01, triggering a mismatched version warning on unpickle. Since we aren't testing the version-compatibility warning, set `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MATPLOTLIB` in the subprocess call so that versions match. Also, set the `dist_name` parameter when querying setuptools-scm or it won't check that environment variable.
1 parent 08da740 commit 16fad2e
Copy full SHA for 16fad2e

File tree

Expand file treeCollapse file tree

2 files changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-1
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def _get_version():
225225
else:
226226
return setuptools_scm.get_version(
227227
root=root,
228+
dist_name="matplotlib",
228229
version_scheme="release-branch-semver",
229230
local_scheme="node-and-date",
230231
fallback_version=_version.version,

‎lib/matplotlib/tests/test_pickle.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_pickle.py
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,15 @@ def test_pickle_load_from_subprocess(fig_test, fig_ref, tmp_path):
150150
proc = subprocess_run_helper(
151151
_pickle_load_subprocess,
152152
timeout=60,
153-
extra_env={'PICKLE_FILE_PATH': str(fp), 'MPLBACKEND': 'Agg'}
153+
extra_env={
154+
"PICKLE_FILE_PATH": str(fp),
155+
"MPLBACKEND": "Agg",
156+
# subprocess_run_helper will set SOURCE_DATE_EPOCH=0, so for a dirty tree,
157+
# the version will have the date 19700101. As we aren't trying to test the
158+
# version compatibility warning, force setuptools-scm to use the same
159+
# version as us.
160+
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MATPLOTLIB": mpl.__version__,
161+
},
154162
)
155163

156164
loaded_fig = pickle.loads(ast.literal_eval(proc.stdout))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.