OK I see what's going on.
test-S3.sh uses the mocked boto3 in tests/test-S3/ to do an end-to-end
test (nbdcopy).
test-S3-unit.sh runs the unit tests within the plugin. It's basically
testing the plugin as if it was a standalone Python script (without
nbdkit being involved). This uses an internal MockS3Client class also
inside the plugin.
The second one does actually need real boto3, just because there's an
"import boto3" at the top and we don't set up PYTHONPATH to pick up
the tests/test-S3/ subdirectory.
We could either fix the second one by skipping it if (real) boto3
isn't installed, or by making it use the mocked boto3 from tests/test-S3/
Either approach would work, but the second one (below) seems maybe
better because we'd get more test coverage this way?
Rich.
diff --git a/tests/test-S3-unit.sh b/tests/test-S3-unit.sh
index 6b6adf02..11718be3 100755
--- a/tests/test-S3-unit.sh
+++ b/tests/test-S3-unit.sh
@@ -44,6 +44,6 @@ if [ "$NBDKIT_VALGRIND" = "1" ]; then
exit 77
fi
-export PYTHONPATH=$srcdir/../plugins/S3:$PYTHONPATH
+export PYTHONPATH=$srcdir/../plugins/S3:$srcdir/test-S3:$PYTHONPATH
$PYTHON -m unittest S3
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW