Skip to content

Commit 60694a8

Browse files
committed
test test_io in a seperated run
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
1 parent 3e919a1 commit 60694a8

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/test_python.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ jobs:
5353
- run: pytest --cov=deepmd source/tests --durations=0 --splits 6 --group ${{ matrix.group }} --store-durations --durations-path=.test_durations --splitting-algorithm least_duration
5454
env:
5555
NUM_WORKERS: 0
56+
- name: Test TF2 eager mode
57+
run: pytest --cov=deepmd source/tests/consistent/io/test_io.py --durations=0
58+
env:
59+
NUM_WORKERS: 0
60+
DP_TEST_TF2_ONLY: 1
61+
if: matrix.group == 1
5662
- run: mv .test_durations .test_durations_${{ matrix.group }}
5763
- name: Upload partial durations
5864
uses: actions/upload-artifact@v4

source/tests/consistent/io/test_io.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from ...utils import (
2525
CI,
26+
DP_TEST_TF2_ONLY,
2627
TEST_DEVICE,
2728
)
2829

@@ -72,6 +73,7 @@ def tearDown(self):
7273
shutil.rmtree(ii)
7374

7475
@unittest.skipIf(TEST_DEVICE != "cpu" and CI, "Only test on CPU.")
76+
@unittest.skipIf(DP_TEST_TF2_ONLY, "Conflict with TF2 eager mode.")
7577
def test_data_equal(self):
7678
prefix = "test_consistent_io_" + self.__class__.__name__.lower()
7779
for backend_name, suffix_idx in (
@@ -141,12 +143,11 @@ def test_deep_eval(self):
141143
prefix = "test_consistent_io_" + self.__class__.__name__.lower()
142144
rets = []
143145
for backend_name, suffix_idx in (
144-
("tensorflow", 0),
146+
# unfortunately, jax2tf cannot work with tf v1 behaviors
147+
("jax", 2) if DP_TEST_TF2_ONLY else ("tensorflow", 0),
145148
("pytorch", 0),
146149
("dpmodel", 0),
147150
("jax", 0),
148-
# unfortunately, jax2tf cannot work with tf v1 behaviors
149-
# ("jax", 2),
150151
):
151152
backend = Backend.get_backend(backend_name)()
152153
if not backend.is_available():

source/tests/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88

99
# see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
1010
CI = os.environ.get("CI") == "true"
11+
DP_TEST_TF2_ONLY = os.environ.get("DP_TEST_TF2_ONLY") == "1"

0 commit comments

Comments
 (0)