-
Notifications
You must be signed in to change notification settings - Fork 262
1 test fai 8000 ls: test_pkg_info #1285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Are you able to add patches? I'm happy to include a fix, but I'd rather not re-release just for this fix. Please try this patch: diff --git a/nibabel/pkg_info.py b/nibabel/pkg_info.py
index 7e816939..7232806a 100644
--- a/nibabel/pkg_info.py
+++ b/nibabel/pkg_info.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import sys
+from contextlib import suppress
from subprocess import run
from packaging.version import Version
@@ -102,14 +103,16 @@ def pkg_commit_hash(pkg_path: str | None = None) -> tuple[str, str]:
ver = Version(__version__)
if ver.local is not None and ver.local.startswith('g'):
return 'installation', ver.local[1:8]
- # maybe we are in a repository
- proc = run(
- ('git', 'rev-parse', '--short', 'HEAD'),
- capture_output=True,
- cwd=pkg_path,
- )
- if proc.stdout:
- return 'repository', proc.stdout.decode().strip()
+ # maybe we are in a repository, but consider that we may not have git
+ with suppress(FileNotFoundError):
+ proc = run(
+ ('git', 'rev-parse', '--short', 'HEAD'),
+ capture_output=True,
+ cwd=pkg_path,
+ )
+ if proc.stdout:
+ return 'repository', proc.stdout.decode().strip()
+
return '(none found)', '<not found>'
|
This patch fixes the failing test, thank you. |
Thank you for checking. I will make sure this is in the next release, which will either be 5.2.1 or 6.0.0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version: 5.2.0
Python-3.9
FreeBSD 13.2
The text was updated successfully, but these errors were encountered: