未验证 提交 404162ba 编写于 作者: A Ainavo 提交者: GitHub

[Test Mv] move dygraph_to_static to test dir (#52069)

上级 3ebb7e4d
...@@ -35,11 +35,11 @@ ignore = ...@@ -35,11 +35,11 @@ ignore =
W503 W503
per-file-ignores = per-file-ignores =
# These files need tabs for testing. # These files need tabs for testing.
python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py:E101,W191 test/dygraph_to_static/test_error.py:E101,W191
python/paddle/fluid/tests/unittests/collective/fleet/test_hdfs1.py:E101,W191 python/paddle/fluid/tests/unittests/collective/fleet/test_hdfs1.py:E101,W191
# Ignore unused imports in __init__.py # Ignore unused imports in __init__.py
__init__.py: F401 __init__.py: F401
# Ignore undefined variables in CMake config and some dygraph_to_static tests # Ignore undefined variables in CMake config and some dygraph_to_static tests
.cmake-format.py: F821 .cmake-format.py: F821
python/paddle/fluid/tests/unittests/dygraph_to_static/test_loop.py: F821 test/dygraph_to_static/test_loop.py: F821
python/paddle/fluid/tests/unittests/dygraph_to_static/test_closure_analysis.py: F821 test/dygraph_to_static/test_closure_analysis.py: F821
...@@ -40,7 +40,7 @@ repos: ...@@ -40,7 +40,7 @@ repos:
(?x)^( (?x)^(
python/paddle/fluid/(?!tests).+| python/paddle/fluid/(?!tests).+|
python/paddle/fluid/tests/unittests/collective/fleet/test_hdfs1.py| python/paddle/fluid/tests/unittests/collective/fleet/test_hdfs1.py|
python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py test/dygraph_to_static/test_error.py
)$ )$
- repo: local - repo: local
hooks: hooks:
......
...@@ -133,6 +133,6 @@ ignore = [ ...@@ -133,6 +133,6 @@ ignore = [
# Ignore version check in setup.py # Ignore version check in setup.py
"setup.py" = ["UP036"] "setup.py" = ["UP036"]
# Ignore unnecessary comprehension in dy2st unittest test_loop # Ignore unnecessary comprehension in dy2st unittest test_loop
"python/paddle/fluid/tests/unittests/dygraph_to_static/test_loop.py" = ["C416"] "test/dygraph_to_static/test_loop.py" = ["C416"]
# Ignore unnecessary lambda in dy2st unittest test_lambda # Ignore unnecessary lambda in dy2st unittest test_lambda
"python/paddle/fluid/tests/unittests/dygraph_to_static/test_lambda.py" = ["PLC3002"] "test/dygraph_to_static/test_lambda.py" = ["PLC3002"]
...@@ -821,7 +821,6 @@ if(NOT WIN32) ...@@ -821,7 +821,6 @@ if(NOT WIN32)
endif() endif()
add_subdirectory(sequence) add_subdirectory(sequence)
add_subdirectory(dygraph_to_static)
add_subdirectory(rnn) add_subdirectory(rnn)
add_subdirectory(distribution) add_subdirectory(distribution)
......
...@@ -5,6 +5,68 @@ set(PYTHON_TESTS_DIR ...@@ -5,6 +5,68 @@ set(PYTHON_TESTS_DIR
${PADDLE_BINARY_DIR}/test ${PADDLE_BINARY_DIR}/test
CACHE INTERNAL "python tests directory") CACHE INTERNAL "python tests directory")
function(py_test_modules TARGET_NAME)
if(WITH_TESTING)
set(options SERIAL)
set(oneValueArgs "")
set(multiValueArgs MODULES DEPS ENVS)
cmake_parse_arguments(py_test_modules "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(WITH_COVERAGE AND NOT (WITH_INCREMENTAL_COVERAGE
AND "$ENV{PADDLE_GIT_DIFF_PY_FILE}" STREQUAL ""))
if(WITH_ASCEND_CL)
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env
PYTHONPATH=${PADDLE_BINARY_DIR}/python:$ENV{PYTHONPATH}
${py_test_modules_ENVS}
COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data
${PYTHON_EXECUTABLE} -m coverage run --branch -p
${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python
${py_test_modules_ENVS}
COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data
${PYTHON_EXECUTABLE} -m coverage run --branch -p
${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
else()
if(WITH_ASCEND_CL)
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env
PYTHONPATH=${PADDLE_BINARY_DIR}/python:$ENV{PYTHONPATH}
${py_test_modules_ENVS} ${PYTHON_EXECUTABLE}
${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python
${py_test_modules_ENVS} ${PYTHON_EXECUTABLE}
${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
endif()
if(py_test_modules_SERIAL)
set_property(TEST ${TARGET_NAME} PROPERTY RUN_SERIAL 1)
endif()
if(WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 150)
endif()
endif()
endfunction()
function(bash_test_modules TARGET_NAME) function(bash_test_modules TARGET_NAME)
if(NOT WITH_TESTING) if(NOT WITH_TESTING)
return() return()
...@@ -68,7 +130,7 @@ if(WITH_TESTING) ...@@ -68,7 +130,7 @@ if(WITH_TESTING)
add_subdirectory(dataset) add_subdirectory(dataset)
# add_subdirectory(distributed_passes) # add_subdirectory(distributed_passes)
# add_subdirectory(distribution) # add_subdirectory(distribution)
# add_subdirectory(dygraph_to_static) add_subdirectory(dygraph_to_static)
# add_subdirectory(fft) # add_subdirectory(fft)
# add_subdirectory(fleet) # add_subdirectory(fleet)
if(WITH_IPU) if(WITH_IPU)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册