[med-svn] [Git][med-team/nipype][master] 2 commits: conftest: start each pytest session with a pristine doctest data dir This is...

Andreas Tille (@tille) gitlab at salsa.debian.org
Thu Nov 5 10:07:39 GMT 2026



Andreas Tille pushed to branch master at Debian Med / nipype


Commits:
257ec3af by Andreas Tille at 2026-11-05T10:33:12+01:00
conftest: start each pytest session with a pristine doctest data dir This is needed to enable testing more than one Python3 versions in autopkgtest.

- - - - -
bfadf8c1 by Andreas Tille at 2026-11-05T10:59:36+01:00
Upload to unstable

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/nipype-conftest-cleanup.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,4 +1,4 @@
-nipype (1.12.0-1) UNRELEASED; urgency=medium
+nipype (1.12.0-1) unstable; urgency=medium
 
   * Team upload.
   * Test-Depends: python3-ci-info
@@ -6,8 +6,11 @@ nipype (1.12.0-1) UNRELEASED; urgency=medium
   * Standards-Version: 4.7.4 (routine-update)
   * Set upstream metadata fields: Documentation.
   * Build-Depends: python3-hatchling, python3-hatch-vcs
+  * conftest: start each pytest session with a pristine doctest data dir
+    This is needed to enable testing more than one Python3 versions in
+    autopkgtest.
 
- -- Andreas Tille <tille at debian.org>  Wed, 04 Nov 2026 21:36:06 +0100
+ -- Andreas Tille <tille at debian.org>  Thu, 05 Nov 2026 10:45:44 +0100
 
 nipype (1.10.0-2) unstable; urgency=medium
 


=====================================
debian/patches/nipype-conftest-cleanup.patch
=====================================
@@ -0,0 +1,45 @@
+Description: conftest: start each pytest session with a pristine doctest data dir
+ All doctests run in a single shared directory, <tmp>/nipype tmp/data, which
+ pytest_configure only populates if it does not exist yet, and which is not
+ removed at the end of the session (pytest_unconfigure removes just
+ NIPYPE_TMPDIR). Doctests create entries in that directory, so a second
+ pytest run on the same machine fails:
+  - nipype.interfaces.io.ExportFile: os.mkdir("output_folder") raises
+    FileExistsError
+  - nipype.interfaces.base.traits_extension.Directory: the expected
+    TraitError for the not yet existing 'relative_dir' is not raised
+ This shows up when the test suite runs more than once in the same
+ environment, e.g. during the build and again in autopkgtest, or once per
+ Python version.
+ .
+ Recreate the data dir in the controller process at session start and remove
+ it at session end. xdist workers reuse the controller's copy.
+Author: Andreas Tille <tille at debian.org>
+Forwarded: no
+Last-Update: 2026-11-05
+Assisted-By: claude.ai
+
+--- a/nipype/conftest.py
++++ b/nipype/conftest.py
+@@ -29,12 +29,21 @@ def pytest_configure(config):
+         assert tempfile.gettempdir() == new_base
+         TMP_DATADIR = os.path.join(new_base, "data")
+ 
++    # Start every session from a pristine copy: doctests create files in this
++    # directory, so a copy left over from an earlier session would make them
++    # fail (e.g. os.mkdir("output_folder") -> FileExistsError).
++    # xdist workers reuse the copy made by the controller.
++    if not hasattr(config, "workerinput"):
++        shutil.rmtree(TMP_DATADIR, ignore_errors=True)
++
+     # xdist will result in this being run multiple times
+     if not os.path.exists(TMP_DATADIR):
+         shutil.copytree(NIPYPE_DATADIR, TMP_DATADIR)
+ 
+ 
+ def pytest_unconfigure(config):
++    if not hasattr(config, "workerinput"):
++        shutil.rmtree(TMP_DATADIR, ignore_errors=True)
+     shutil.rmtree(NIPYPE_TMPDIR)
+ 
+ 


=====================================
debian/patches/series
=====================================
@@ -9,3 +9,4 @@ fix-transpose.patch
 reproducible-build.patch
 fix-privacy-breaches.patch
 stabilize-makefiles.patch
+nipype-conftest-cleanup.patch



View it on GitLab: https://salsa.debian.org/med-team/nipype/-/compare/145882f3530011737b0165701b597e81612e4a88...bfadf8c1abf4c9dc2ba83dd996f3f233d9143b94

-- 
View it on GitLab: https://salsa.debian.org/med-team/nipype/-/compare/145882f3530011737b0165701b597e81612e4a88...bfadf8c1abf4c9dc2ba83dd996f3f233d9143b94
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20261105/92cbec51/attachment-0001.htm>


More information about the debian-med-commit mailing list