sijie closed pull request #2042: Tests Python Wheel packaging in CI build
URL: https://github.com/apache/incubator-pulsar/pull/2042
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/pulsar-client-cpp/python/pulsar_test.py
b/pulsar-client-cpp/python/pulsar_test.py
index b07abbc998..6c8e6c7948 100755
--- a/pulsar-client-cpp/python/pulsar_test.py
+++ b/pulsar-client-cpp/python/pulsar_test.py
@@ -21,6 +21,7 @@
from unittest import TestCase, main
import time
+import os
from pulsar import Client, MessageId, \
CompressionType, ConsumerType, PartitionsRoutingMode, \
AuthenticationTLS
@@ -125,7 +126,9 @@ def test_producer_consumer(self):
client.close()
def test_tls_auth(self):
- certs_dir =
"../../pulsar-broker/src/test/resources/authentication/tls/"
+ certs_dir =
'/pulsar/pulsar-broker/src/test/resources/authentication/tls/'
+ if not os.path.exists(certs_dir):
+ certs_dir =
"../../pulsar-broker/src/test/resources/authentication/tls/"
client = Client(self.serviceUrlTls,
tls_trust_certs_file_path=certs_dir + 'cacert.pem',
tls_allow_insecure_connection=False,
diff --git a/pulsar-client-cpp/run-unit-tests.sh
b/pulsar-client-cpp/run-unit-tests.sh
index b0bdcd1e6a..4eac8031fc 100755
--- a/pulsar-client-cpp/run-unit-tests.sh
+++ b/pulsar-client-cpp/run-unit-tests.sh
@@ -57,7 +57,7 @@ PULSAR_CLIENT_CONF=$PWD/test-conf/client-ssl.conf
pulsar-dist/bin/pulsar-admin c
sleep 5
-cd tests
+pushd tests
if [ -f /gtest-parallel/gtest-parallel ]; then
echo "---- Run unit tests in parallel"
@@ -68,11 +68,29 @@ else
RES=$?
fi
+popd
+
if [ $RES -eq 0 ]; then
+ pushd python
+ echo "---- Build Python Wheel file"
+ python setup.py bdist_wheel
+
+ echo "---- Installing Python Wheel file"
+ pip install dist/pulsar_client-*-linux_x86_64.whl
+
echo "---- Running Python unit tests"
- cd ../python
+
+ # Running tests from a different directory to avoid importing directly
+ # from the current dir, but rather using the installed wheel file
+ cp pulsar_test.py /tmp
+ pushd /tmp
+
python pulsar_test.py
RES=$?
+
+ popd
+ popd
+
fi
kill -9 $standalone_pid $auth_pid
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services