[Libguestfs] [PATCH nbdkit] s3: Only run the tests if boto3 is installed

Richard W.M. Jones rjones at redhat.com
Tue May 17 08:55:36 UTC 2022


ERROR: S3 (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: S3
Traceback (most recent call last):
  File "/usr/lib64/python3.10/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/rjones/d/nbdkit/plugins/S3/S3.py", line 41, in <module>
    import boto3
ModuleNotFoundError: No module named 'boto3'

Reported-by: Laszlo Ersek
Fixes: commit 5130c43bc1f9
---
 tests/test-S3-unit.sh | 1 +
 tests/test-S3.sh      | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tests/test-S3-unit.sh b/tests/test-S3-unit.sh
index 6b6adf02..8a32dd4c 100755
--- a/tests/test-S3-unit.sh
+++ b/tests/test-S3-unit.sh
@@ -37,6 +37,7 @@ set -x
 
 requires $PYTHON --version
 requires $PYTHON -c 'import unittest'
+requires $PYTHON -c 'import boto3'
 
 # Python has proven very difficult to valgrind, therefore it is disabled.
 if [ "$NBDKIT_VALGRIND" = "1" ]; then
diff --git a/tests/test-S3.sh b/tests/test-S3.sh
index de94751e..e51ef2ac 100755
--- a/tests/test-S3.sh
+++ b/tests/test-S3.sh
@@ -36,6 +36,7 @@ set -x
 
 requires hexdump --version
 requires $PYTHON --version
+requires $PYTHON -c 'import boto3'
 requires nbdcopy --version
 requires_plugin python
 
-- 
2.35.1



More information about the Libguestfs mailing list