Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#4322] fix: python-client module import error (#4326)

Xun Liue5206eafde45
diff --git a/.github/workflows/python-integration-test.yml b/.github/workflows/python-integration-test.yml
index a7ffacfd72..4e9f96bc69 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 f8ec9ea6cb..6a92bd06db 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 574a68ddb5..932e8d3fbd 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"]