From 905b99bd6c3e2c436ba87d097838a06d3ae37eeb Mon Sep 17 00:00:00 2001 From: Michael Hanke Date: Tue, 21 May 2024 11:12:33 +0200 Subject: [PATCH] fix(dependencies): limit test patch import to test runs Since 1.4.0 a plain `datalad_next` import required `pytest`. This was due to the datalad-core patch `fix_ria_ora_tests` added in #669, and was discovered by Debian's CI Thanks to @aqw for the recommendation. Closes: https://github.com/datalad/datalad-next/issues/698 Refs: https://github.com/datalad/datalad-next/pull/669, https://ci.debian.net/packages/d/datalad-next/testing/amd64/46884776/ --- datalad_next/patches/patch_ria_ora.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/datalad_next/patches/patch_ria_ora.py b/datalad_next/patches/patch_ria_ora.py index b101312a..78428bf0 100644 --- a/datalad_next/patches/patch_ria_ora.py +++ b/datalad_next/patches/patch_ria_ora.py @@ -7,6 +7,7 @@ class :class:`SSHRemoteIO`. 2. Improve ORA/RIA-related code so that it also works on Windows. """ +from os import environ from . import ( add_method_url2transport_path, @@ -15,7 +16,15 @@ class :class:`SSHRemoteIO`. # The following patches add Windows-support to ORA/RIA code ria_utils, replace_ora_remote, - fix_ria_ora_tests, +) + +# we only want to import the patches for the tests when actually running +# under pytest. this prevents inflating the runtime dependency with +# test-only dependencies -- which would be needed for the necessary imports +if environ.get("PYTEST_VERSION"): + from . import fix_ria_ora_tests + +from . import ( # `replace_create_sibling_ria` be imported after `replace_sshremoteio` # and `ria_utils`. replace_create_sibling_ria,