Skip to content

Commit

Permalink
test test_io in a seperated run
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Nov 4, 2024
1 parent 3e919a1 commit 60694a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ jobs:
- run: pytest --cov=deepmd source/tests --durations=0 --splits 6 --group ${{ matrix.group }} --store-durations --durations-path=.test_durations --splitting-algorithm least_duration
env:
NUM_WORKERS: 0
- name: Test TF2 eager mode
run: pytest --cov=deepmd source/tests/consistent/io/test_io.py --durations=0
env:
NUM_WORKERS: 0
DP_TEST_TF2_ONLY: 1
if: matrix.group == 1
- run: mv .test_durations .test_durations_${{ matrix.group }}
- name: Upload partial durations
uses: actions/upload-artifact@v4
Expand Down
7 changes: 4 additions & 3 deletions source/tests/consistent/io/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from ...utils import (
CI,
DP_TEST_TF2_ONLY,
TEST_DEVICE,
)

Expand Down Expand Up @@ -72,6 +73,7 @@ def tearDown(self):
shutil.rmtree(ii)

@unittest.skipIf(TEST_DEVICE != "cpu" and CI, "Only test on CPU.")
@unittest.skipIf(DP_TEST_TF2_ONLY, "Conflict with TF2 eager mode.")
def test_data_equal(self):
prefix = "test_consistent_io_" + self.__class__.__name__.lower()
for backend_name, suffix_idx in (
Expand Down Expand Up @@ -141,12 +143,11 @@ def test_deep_eval(self):
prefix = "test_consistent_io_" + self.__class__.__name__.lower()
rets = []
for backend_name, suffix_idx in (
("tensorflow", 0),
# unfortunately, jax2tf cannot work with tf v1 behaviors
("jax", 2) if DP_TEST_TF2_ONLY else ("tensorflow", 0),
("pytorch", 0),
("dpmodel", 0),
("jax", 0),
# unfortunately, jax2tf cannot work with tf v1 behaviors
# ("jax", 2),
):
backend = Backend.get_backend(backend_name)()
if not backend.is_available():
Expand Down
1 change: 1 addition & 0 deletions source/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@

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

0 comments on commit 60694a8

Please sign in to comment.