This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/develop by this push:
new 2025ee20 Use pytest to run python test (#194)
2025ee20 is described below
commit 2025ee200350c26e355d4c0737987fd0f8965169
Author: Haonan <[email protected]>
AuthorDate: Fri Aug 2 00:57:04 2024 +0800
Use pytest to run python test (#194)
---
.github/workflows/code-coverage.yml | 2 +-
python/pom.xml | 18 +++++++++++++++++-
python/test.py | 2 +-
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/code-coverage.yml
b/.github/workflows/code-coverage.yml
index f1a4f116..3240ee0d 100644
--- a/.github/workflows/code-coverage.yml
+++ b/.github/workflows/code-coverage.yml
@@ -27,7 +27,7 @@ jobs:
- name: Generate code coverage reports
run: |
sudo apt-get install lcov
- ./mvnw -B -P with-java,with-cpp,with-code-coverage clean verify
+ ./mvnw -B -P with-java,with-cpp,with-python,with-code-coverage clean
verify
lcov --capture --directory cpp/target/build/test --output-file
cpp/target/build/test/coverage.info
lcov --remove cpp/target/build/test/coverage.info
'*/tsfile/cpp/test/*' --output-file cpp/target/build/test/coverage_filtered.info
genhtml cpp/target/build/test/coverage_filtered.info
--output-directory cpp/target/build/test/coverage_report
diff --git a/python/pom.xml b/python/pom.xml
index 63a3689f..0efca65c 100644
--- a/python/pom.xml
+++ b/python/pom.xml
@@ -107,6 +107,22 @@
</arguments>
</configuration>
</execution>
+ <execution>
+ <id>python-install-test-requirements</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+
<executable>${python.venv.bin}${python.exe.bin}</executable>
+ <arguments>
+ <argument>-m</argument>
+ <argument>pip</argument>
+ <argument>install</argument>
+ <argument>pytest</argument>
+ </arguments>
+ </configuration>
+ </execution>
<execution>
<id>run-python-tests</id>
<phase>test</phase>
@@ -114,7 +130,7 @@
<goal>exec</goal>
</goals>
<configuration>
-
<executable>${python.venv.bin}${python.exe.bin}</executable>
+ <executable>${python.venv.bin}pytest</executable>
<arguments>
<argument>${project.basedir}/test.py</argument>
</arguments>
diff --git a/python/test.py b/python/test.py
index e4838742..29fb6c24 100644
--- a/python/test.py
+++ b/python/test.py
@@ -29,7 +29,7 @@ import tsfile as ts
from tsfile.tsfile import EmptyFileError
TABLE_NAME = "test_table"
-DATA_PATH = os.path.join(os.path.dirname(__file__), "data")
+DATA_PATH = os.path.join(os.path.dirname(__file__), "target")
# test writing data