Skip to content

Commit 62c0304

Browse files
authored
[CustomDevice]change import way of unpublished file in op_test test=allcases (#42285)
* test op_test test=allcases * fix * avoid copy many same file * fix for win * test PYTHONPATH * change path adding way * fix win * use old way * use old way test=allcase * use old way test=allcase
1 parent f450797 commit 62c0304

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

paddle/scripts/paddle_build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,8 @@ function run_linux_cpu_test() {
752752
pip install hypothesis
753753
pip install ${PADDLE_ROOT}/build/python/dist/*whl
754754
cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/op_test.py ${PADDLE_ROOT}/build/python
755+
cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/testsuite.py ${PADDLE_ROOT}/build/python
756+
cp -r ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/white_list ${PADDLE_ROOT}/build/python
755757
ut_total_startTime_s=`date +%s`
756758
if [ ${WITH_TESTING:-ON} == "ON" ] ; then
757759
cat <<EOF
@@ -2404,6 +2406,8 @@ function parallel_test() {
24042406
pip install hypothesis
24052407
pip install ${PADDLE_ROOT}/build/python/dist/*whl
24062408
cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/op_test.py ${PADDLE_ROOT}/build/python
2409+
cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/testsuite.py ${PADDLE_ROOT}/build/python
2410+
cp -r ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/white_list ${PADDLE_ROOT}/build/python
24072411
ut_total_startTime_s=`date +%s`
24082412
if [ "$WITH_CINN" == "ON" ];then
24092413
parallel_test_base_cinn

python/paddle/fluid/tests/unittests/op_test.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from __future__ import print_function
1616

1717
import os
18+
import sys
1819
import unittest
1920
import warnings
2021
import numpy as np
@@ -37,20 +38,22 @@
3738
from paddle.fluid.op import Operator
3839
from paddle.fluid.executor import Executor
3940
from paddle.fluid.framework import Program, OpProtoHolder, Variable, _current_expected_place
40-
from paddle.fluid.tests.unittests.testsuite import (
41+
from paddle.fluid import unique_name
42+
from paddle.fluid.dygraph.dygraph_to_static.utils import parse_arg_and_kwargs
43+
44+
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
45+
from testsuite import (
4146
create_op,
4247
set_input,
4348
append_input_output,
4449
append_loss_ops, )
45-
from paddle.fluid import unique_name
46-
from paddle.fluid.tests.unittests.white_list import (
50+
from white_list import (
4751
op_accuracy_white_list,
4852
check_shape_white_list,
4953
compile_vs_runtime_white_list,
5054
no_check_set_white_list,
5155
op_threshold_white_list,
5256
no_grad_set_white_list, )
53-
from paddle.fluid.dygraph.dygraph_to_static.utils import parse_arg_and_kwargs
5457

5558
# For switch new eager mode globally
5659
g_is_in_eager = _in_eager_without_dygraph_check()

0 commit comments

Comments
 (0)