Skip to content

Commit adfe22b

Browse files
author
yuzelin
committed
try fix?
1 parent 589f869 commit adfe22b

File tree

3 files changed

+54
-14
lines changed

3 files changed

+54
-14
lines changed

pypaimon/py4j/tests/test_data_types.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,44 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
################################################################################
18-
18+
import os
1919
import random
20+
import shutil
2021
import string
22+
import tempfile
23+
2124
import pyarrow as pa
2225
import unittest
2326

2427
from pypaimon import Schema
25-
from pypaimon.py4j.tests import utils
26-
from pypaimon.py4j.util import java_utils
28+
from pypaimon.py4j import Catalog
29+
from pypaimon.py4j.tests.utils import _setup_hadoop_bundle_jar, _setup_bridge_jar
30+
from pypaimon.py4j.util import java_utils, constants
2731

2832

2933
class DataTypesTest(unittest.TestCase):
3034

3135
@classmethod
3236
def setUpClass(cls):
33-
cls.tempdir, cls.warehouse, cls.catalog = utils.setup_class()
37+
os.environ[constants.PYPAIMON4J_TEST_MODE] = 'true'
38+
cls.tempdir = tempfile.mkdtemp()
39+
40+
_setup_hadoop_bundle_jar(cls.tempdir)
41+
_setup_bridge_jar(cls.tempdir)
42+
43+
cls.warehouse = os.path.join(cls.tempdir, 'warehouse')
44+
cls.catalog = Catalog.create({'warehouse': cls.warehouse})
45+
cls.catalog.create_database('default', False)
46+
3447
cls.simple_pa_schema = pa.schema([
3548
('f0', pa.int32()),
3649
('f1', pa.string())
3750
])
3851

3952
@classmethod
4053
def tearDownClass(cls):
41-
utils.teardown_class(cls.tempdir)
54+
shutil.rmtree(cls.tempdir, ignore_errors=True)
55+
del os.environ[constants.PYPAIMON4J_TEST_MODE]
4256

4357
def test_int(self):
4458
pa_schema = pa.schema([

pypaimon/py4j/tests/test_preicates.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
################################################################################
18-
18+
import os
19+
import shutil
20+
import tempfile
1921
import unittest
2022
import random
2123
import pandas as pd
2224
import pyarrow as pa
2325

2426
from pypaimon import Schema
25-
from pypaimon.py4j.tests import utils
27+
from pypaimon.py4j import Catalog
28+
from pypaimon.py4j.tests.utils import _setup_hadoop_bundle_jar, _setup_bridge_jar
29+
from pypaimon.py4j.util import constants
2630

2731

2832
def _check_filtered_result(read_builder, expected_df):
@@ -42,7 +46,16 @@ class PredicateTest(unittest.TestCase):
4246

4347
@classmethod
4448
def setUpClass(cls):
45-
cls.tempdir, cls.warehouse, cls.catalog = utils.setup_class()
49+
os.environ[constants.PYPAIMON4J_TEST_MODE] = 'true'
50+
cls.tempdir = tempfile.mkdtemp()
51+
52+
_setup_hadoop_bundle_jar(cls.tempdir)
53+
_setup_bridge_jar(cls.tempdir)
54+
55+
cls.warehouse = os.path.join(cls.tempdir, 'warehouse')
56+
cls.catalog = Catalog.create({'warehouse': cls.warehouse})
57+
cls.catalog.create_database('default', False)
58+
4659
pa_schema = pa.schema([
4760
('f0', pa.int64()),
4861
('f1', pa.string()),
@@ -82,7 +95,8 @@ def setUpClass(cls):
8295

8396
@classmethod
8497
def tearDownClass(cls):
85-
utils.teardown_class(cls.tempdir)
98+
shutil.rmtree(cls.tempdir, ignore_errors=True)
99+
del os.environ[constants.PYPAIMON4J_TEST_MODE]
86100

87101
def testWrongFieldName(self):
88102
table = self.catalog.get_table('default.test_append')

pypaimon/py4j/tests/test_write_and_read.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
################################################################################
18-
18+
import os
19+
import shutil
20+
import tempfile
1921
import unittest
2022
import pandas as pd
2123
import pyarrow as pa
@@ -24,23 +26,33 @@
2426
from pypaimon import Schema
2527
from pypaimon.py4j import Catalog
2628
from pypaimon.py4j.java_gateway import get_gateway
27-
from pypaimon.py4j.tests import utils
28-
from pypaimon.py4j.util import java_utils
29+
from pypaimon.py4j.tests.utils import _setup_hadoop_bundle_jar, _setup_bridge_jar
30+
from pypaimon.py4j.util import java_utils, constants
2931

3032

3133
class TableWriteReadTest(unittest.TestCase):
3234

3335
@classmethod
3436
def setUpClass(cls):
35-
cls.tempdir, cls.warehouse, cls.catalog = utils.setup_class()
37+
os.environ[constants.PYPAIMON4J_TEST_MODE] = 'true'
38+
cls.tempdir = tempfile.mkdtemp()
39+
40+
_setup_hadoop_bundle_jar(cls.tempdir)
41+
_setup_bridge_jar(cls.tempdir)
42+
43+
cls.warehouse = os.path.join(cls.tempdir, 'warehouse')
44+
cls.catalog = Catalog.create({'warehouse': cls.warehouse})
45+
cls.catalog.create_database('default', False)
46+
3647
cls.simple_pa_schema = pa.schema([
3748
('f0', pa.int32()),
3849
('f1', pa.string())
3950
])
4051

4152
@classmethod
4253
def tearDownClass(cls):
43-
utils.teardown_class(cls.tempdir)
54+
shutil.rmtree(cls.tempdir, ignore_errors=True)
55+
del os.environ[constants.PYPAIMON4J_TEST_MODE]
4456

4557
def testReadEmptyAppendTable(self):
4658
schema = Schema(self.simple_pa_schema)

0 commit comments

Comments
 (0)