This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury.git


The following commit(s) were added to refs/heads/main by this push:
     new 5f18713d feat(dart): add `test_config.yaml` and apply `TestConfig` for 
environment-specific settings (#2183)
5f18713d is described below

commit 5f18713d390e06a0f82d950236ec5cfcb54ff628
Author: LouShaokun <[email protected]>
AuthorDate: Thu Apr 24 19:00:11 2025 +0800

    feat(dart): add `test_config.yaml` and apply `TestConfig` for 
environment-specific settings (#2183)
    
    <!--
    **Thanks for contributing to Fury.**
    
    **If this is your first time opening a PR on Fury, you can refer to
    
[CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).**
    
    Contribution Checklist
    
    - The **Apache Fury (incubating)** community has restrictions on the
    naming of PR titles. You can also find instructions in
    [CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).
    - Fury has a strong focus on performance. If the PR you submit will have
    an impact on performance, please benchmark it first and provide the
    benchmark result here.
    -->
    
    ## What does this PR do?
    
    This PR externalizes test configuration for the Dart `fury-test` package
    by introducing a `test_config.yaml` file under `dart/fury-test/`. It
    defines a new `TestConfig` data class to load user‑provided settings
    (e.g. paths, executables) from that YAML file. All hardcoded values in
    the test suite—such as `pythonExecutable` in
    `lib/util/cross_lang_util.dart`—are replaced with properties from
    `TestConfig`.
    
    ## Related issues
    
    <!--
    Is there any related issue? Please attach here.
    
    - #xxxx0
    - #xxxx1
    - #xxxx2
    -->
    
    ## Does this PR introduce any user-facing change?
    
    - Users must now provide a `test_config.yaml` in their local environment
    to configure test parameters (no defaults are hardcoded).
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
    
    <!--
    When the PR has an impact on performance (if you don't know whether the
    PR will have an impact on performance, you can submit the PR first, and
    if it will have impact on performance, the code reviewer will explain
    it), be sure to attach benchmark data here.
    -->
---
 dart/README.md                                     | 12 +++++--
 dart/packages/fury-test/lib/test_config.dart       | 42 ++++++++++++++++++++++
 .../fury-test/lib/util/cross_lang_util.dart        |  3 +-
 dart/packages/fury-test/pubspec.yaml               |  1 +
 .../fury-test/{pubspec.yaml => test_config.yaml}   | 23 ++----------
 5 files changed, 56 insertions(+), 25 deletions(-)

diff --git a/dart/README.md b/dart/README.md
index 998c16cd..f610aea2 100644
--- a/dart/README.md
+++ b/dart/README.md
@@ -127,13 +127,13 @@ Fury Dart currently supports the following type mappings 
in XLANG mode:
 
 The implementation is organized into three main components:
 
-1. **Codegen**: Located at `dart/packages/fury/lib/src/codegen`  
+1. **Codegen**: Located at `dart/packages/fury/lib/src/codegen`
    Handles static code generation for serialization/deserialization.
 
-2. **FuryCore**: Located at `dart/packages/fury/lib/src`  
+2. **FuryCore**: Located at `dart/packages/fury/lib/src`
    Contains the core serialization and deserialization logic.
 
-3. **FuryTest**: Located at `dart/fury-test`  
+3. **FuryTest**: Located at `dart/fury-test`
    Comprehensive test suite for Fury Dart functionality.
 
 ## Testing Approach
@@ -164,6 +164,11 @@ dart test
 # See: https://github.com/dart-lang/test/blob/master/pkgs/test/README.md
 ```
 
+#### Additional Configuration
+
+Inside the `fury-test/test_config` directory you will find YAML configuration 
files required by certain tests (for example, the `cross_language` tests).
+Before executing those tests, please review and adjust the configs in 
`fury-test/test_config` (or provide your own) so that they match your 
environment.
+
 ## Code Quality
 
 Fury Dart maintains high code quality standards. You can verify this using:
@@ -206,6 +211,7 @@ build_runner: ^2.4.6
 
 ```
 path: ^1.9.1
+yaml: ^3.1.3
 lints: ^5.0.0
 build: ^2.4.2
 build_runner: ^2.4.15
diff --git a/dart/packages/fury-test/lib/test_config.dart 
b/dart/packages/fury-test/lib/test_config.dart
new file mode 100644
index 00000000..077bb9c0
--- /dev/null
+++ b/dart/packages/fury-test/lib/test_config.dart
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import 'dart:io';
+
+import 'package:yaml/yaml.dart';
+
+class TestConfig {
+  static const String configName = 'test_config.yaml';
+  static final TestConfig I = _loadConfig();
+  final String pythonExecutable;
+
+  TestConfig({required this.pythonExecutable});
+
+  static TestConfig _loadConfig() {
+    final String configPath = '${Directory.current.path}/$configName';
+    final File configFile = File(configPath);
+    if (!configFile.existsSync()) {
+      throw ArgumentError('Config file not found: $configPath');
+    }
+    final config = loadYaml(configFile.readAsStringSync());
+    return TestConfig(
+      pythonExecutable: (config['python'] ? ['executable'] as String?) ?? 
'python',
+    );
+  }
+}
diff --git a/dart/packages/fury-test/lib/util/cross_lang_util.dart 
b/dart/packages/fury-test/lib/util/cross_lang_util.dart
index 584933ff..ffc80af1 100644
--- a/dart/packages/fury-test/lib/util/cross_lang_util.dart
+++ b/dart/packages/fury-test/lib/util/cross_lang_util.dart
@@ -21,11 +21,12 @@ import 'dart:io';
 import 'dart:typed_data';
 import 'package:checks/checks.dart';
 import 'package:fury/fury.dart';
+import 'package:fury_test/test_config.dart';
 import 'package:fury_test/util/test_file_util.dart';
 import 'package:fury_test/util/test_process_util.dart';
 
 final class CrossLangUtil{
-  static const String pythonExecutable = 
"C:/Users/86511/.conda/envs/pyfury_dev6/python.exe";
+  static final String pythonExecutable = TestConfig.I.pythonExecutable;
   static const String pythonModule= "pyfury.tests.test_cross_language";
   static const Map<String,String> env = {'ENABLE_CROSS_LANGUAGE_TESTS': 
'true'};
 
diff --git a/dart/packages/fury-test/pubspec.yaml 
b/dart/packages/fury-test/pubspec.yaml
index 7da9fbf6..e771cb76 100644
--- a/dart/packages/fury-test/pubspec.yaml
+++ b/dart/packages/fury-test/pubspec.yaml
@@ -28,6 +28,7 @@ dependencies:
   fury: 1.0.0
   checks: ^0.3.0
   path: ^1.9.1
+  yaml: ^3.1.3
 dev_dependencies:
   lints: ^5.0.0
   build_runner: any
diff --git a/dart/packages/fury-test/pubspec.yaml 
b/dart/packages/fury-test/test_config.yaml
similarity index 70%
copy from dart/packages/fury-test/pubspec.yaml
copy to dart/packages/fury-test/test_config.yaml
index 7da9fbf6..bf68bbae 100644
--- a/dart/packages/fury-test/pubspec.yaml
+++ b/dart/packages/fury-test/test_config.yaml
@@ -15,24 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: fury_test
-description: test for fury dart
-version: 1.0.0
-
-environment:
-  sdk: ^3.6.1
-
-resolution: workspace
-
-dependencies:
-  fury: 1.0.0
-  checks: ^0.3.0
-  path: ^1.9.1
-dev_dependencies:
-  lints: ^5.0.0
-  build_runner: any
-  test: ^1.24.0
-  build_test: ^2.2.3
-  analyzer: '>=6.5.0 <8.0.0'
-  collection: ^1.19.1
-  build: any
+python:
+  executable: python


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to