Commit d567700
authored
fix(pd): fix unitest (#5113)
This pull request refactors several test files to update import paths
for the `expand_sys_str` utility and related modules, reflecting a
migration away from the `deepmd.tf` namespace. Additionally, it
temporarily skips a test due to compatibility issues with numpy 2.4 and
improves file cleanup logic in one test. The main themes are import path
updates and test maintenance.
**Import path updates:**
* Updated imports of `expand_sys_str` in multiple test files
(`test_descriptor.py`, `test_embedding_net.py`, `test_model.py`,
`test_saveload_dpa1.py`, `test_saveload_se_e2_a.py`, `test_sampler.py`)
to use `deepmd.common` instead of `deepmd.tf.common`.
[[1]](diffhunk://#diff-026c6e70e7f5fd37843904e99c43910d638b0da8607e1bc0ab84702f256f3264R16-R18)
[[2]](diffhunk://#diff-026c6e70e7f5fd37843904e99c43910d638b0da8607e1bc0ab84702f256f3264L34-L36)
[[3]](diffhunk://#diff-9d16c9bf54ca3ba29bd1045d492b6a4eb11956305c05631ac8691fe681271535R21-R23)
[[4]](diffhunk://#diff-9d16c9bf54ca3ba29bd1045d492b6a4eb11956305c05631ac8691fe681271535L37-L39)
[[5]](diffhunk://#diff-a3bf7b66e3c105cf0d73116440343c6b0be07ff6246557f04f6707bec0e21af3R22-R24)
[[6]](diffhunk://#diff-a3bf7b66e3c105cf0d73116440343c6b0be07ff6246557f04f6707bec0e21af3L35-L37)
[[7]](diffhunk://#diff-0d7e97b8c00caf452b143cae472e2fa0a97473ba4b685f588bb60c21c504b934R16-R18)
[[8]](diffhunk://#diff-0d7e97b8c00caf452b143cae472e2fa0a97473ba4b685f588bb60c21c504b934L35-L37)
[[9]](diffhunk://#diff-74518d33e0df93e8af8027509351b11fbbe1f32b8c84f6d3a165e1df0953048fR16-R18)
[[10]](diffhunk://#diff-74518d33e0df93e8af8027509351b11fbbe1f32b8c84f6d3a165e1df0953048fL35-L37)
[[11]](diffhunk://#diff-fd952e5725b949f09ee868247a1a5b0b1b383a25b096766fa994a102a3aeca31R16-R24)
* Changed import of `DeepmdDataSystem` in `test_sampler.py` from
`deepmd.tf.utils.data_system` to `deepmd.utils.data_system`.
**Test maintenance and compatibility:**
* Temporarily skipped the `test_sampler_debug_info` test in
`test_sampler.py` due to issues with numpy 2.4.
* Enhanced file cleanup in `test_training.py` by checking for file
existence before attempting to remove files or directories.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Tests**
* Improved test robustness by adding existence checks before file
cleanup operations to prevent errors.
* Temporarily skipped one test due to numpy compatibility issues.
* **Chores**
* Reorganized internal module imports for improved code structure.
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Related PR: <PaddlePaddle/Paddle#77013>1 parent 188dae3 commit d567700
File tree
7 files changed
+26
-22
lines changed- source/tests/pd
- model
7 files changed
+26
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
| 140 | + | |
140 | 141 | | |
141 | | - | |
| 142 | + | |
| 143 | + | |
142 | 144 | | |
143 | | - | |
| 145 | + | |
| 146 | + | |
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
| |||
0 commit comments