This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new e5206eafd [#4322] fix: python-client module import error (#4326)
e5206eafd is described below
commit e5206eafde45b2c4b5f42068db7213bbb0ccb993
Author: Xun Liu <[email protected]>
AuthorDate: Thu Aug 1 14:02:08 2024 +0800
[#4322] fix: python-client module import error (#4326)
### What changes were proposed in this pull request?
Add `PYTHONPATH` environment and point Gravitino Python client path in
the CI workflow.
Make Python search for module in the correct path.
### Why are the changes needed?
Fix: #4322
### Does this PR introduce _any_ user-facing change?
N/A
### How was this patch tested?
CI Passed
---
.github/workflows/python-integration-test.yml | 1 +
clients/client-python/build.gradle.kts | 23 +++++++++++++++-------
.../tests/unittests/test_name_identifier.py | 1 -
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/python-integration-test.yml
b/.github/workflows/python-integration-test.yml
index a7ffacfd7..4e9f96bc6 100644
--- a/.github/workflows/python-integration-test.yml
+++ b/.github/workflows/python-integration-test.yml
@@ -24,6 +24,7 @@ jobs:
source_changes:
- .github/**
- api/**
+ - catalogs/catalog-hadoop/**
- clients/client-python/**
- common/**
- conf/**
diff --git a/clients/client-python/build.gradle.kts
b/clients/client-python/build.gradle.kts
index f8ec9ea6c..6a92bd06d 100644
--- a/clients/client-python/build.gradle.kts
+++ b/clients/client-python/build.gradle.kts
@@ -213,16 +213,19 @@ tasks {
if (dockerTest) {
dependsOn("verifyHadoopPack")
envMap.putAll(mapOf(
- "HADOOP_VERSION" to hadoopVersion,
- "PYTHON_BUILD_PATH" to project.rootDir.path +
"/clients/client-python/build"
+ "HADOOP_VERSION" to hadoopVersion,
+ "PYTHON_BUILD_PATH" to project.rootDir.path +
"/clients/client-python/build"
))
}
envMap.putAll(mapOf(
- "PROJECT_VERSION" to project.version,
- "GRAVITINO_HOME" to project.rootDir.path + "/distribution/package",
- "START_EXTERNAL_GRAVITINO" to "true",
- "DOCKER_TEST" to dockerTest.toString(),
- "GRAVITINO_CI_HIVE_DOCKER_IMAGE" to
"datastrato/gravitino-ci-hive:0.1.13",
+ "PROJECT_VERSION" to project.version,
+ "GRAVITINO_HOME" to project.rootDir.path + "/distribution/package",
+ "START_EXTERNAL_GRAVITINO" to "true",
+ "DOCKER_TEST" to dockerTest.toString(),
+ "GRAVITINO_CI_HIVE_DOCKER_IMAGE" to
"datastrato/gravitino-ci-hive:0.1.13",
+ // Set the PYTHONPATH to the client-python directory, make sure the
tests can import the
+ // modules from the client-python directory.
+ "PYTHONPATH" to "${project.rootDir.path}/clients/client-python"
))
environment = envMap
@@ -244,6 +247,12 @@ tasks {
args = listOf("run", "--branch", "-m", "unittest")
workingDir = projectDir.resolve("./tests/unittests")
+ environment = mapOf(
+ // Set the PYTHONPATH to the client-python directory, make sure the
tests can import the
+ // modules from the client-python directory.
+ "PYTHONPATH" to "${project.rootDir.path}/clients/client-python"
+ )
+
finalizedBy(unitCoverageReport)
}
diff --git a/clients/client-python/tests/unittests/test_name_identifier.py
b/clients/client-python/tests/unittests/test_name_identifier.py
index 574a68ddb..932e8d3fb 100644
--- a/clients/client-python/tests/unittests/test_name_identifier.py
+++ b/clients/client-python/tests/unittests/test_name_identifier.py
@@ -37,7 +37,6 @@ class TestNameIdentifier(unittest.TestCase):
self.assertNotEqual("test2", identifier_dict.get(name_identifier1))
def test_from_json_name_identifier(self):
-
test_name = "test_name_identifier"
test_namespace_levels = ["1", "2", "3", "4"]