| 31 | |
| 32 | @pytest.fixture(scope="session") |
| 33 | def root_allocator(): |
| 34 | # This test requires Arrow Java to be built in the same source tree |
| 35 | try: |
| 36 | arrow_dir = os.environ["ARROW_SOURCE_DIR"] |
| 37 | except KeyError: |
| 38 | arrow_dir = os.path.join(os.path.dirname(__file__), '..', '..', '..') |
| 39 | pom_path = os.path.join(arrow_dir, 'java', 'pom.xml') |
| 40 | tree = ET.parse(pom_path) |
| 41 | version = tree.getroot().find( |
| 42 | 'POM:version', |
| 43 | namespaces={ |
| 44 | 'POM': 'http://maven.apache.org/POM/4.0.0' |
| 45 | }).text |
| 46 | jar_path = os.path.join( |
| 47 | arrow_dir, 'java', 'tools', 'target', |
| 48 | f'arrow-tools-{version}-jar-with-dependencies.jar') |
| 49 | jar_path = os.getenv("ARROW_TOOLS_JAR", jar_path) |
| 50 | kwargs = {} |
| 51 | # This will be the default behaviour in jpype 0.8+ |
| 52 | kwargs['convertStrings'] = False |
| 53 | jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.class.path=" + jar_path, |
| 54 | **kwargs) |
| 55 | return jpype.JPackage("org").apache.arrow.memory.RootAllocator(sys.maxsize) |
| 56 | |
| 57 | |
| 58 | def test_jvm_buffer(root_allocator): |