未验证 提交 431e8dbd 编写于 作者: K Kim 提交者: GitHub

[Test Mv]mv dataset test (#52148)

* mv python/paddle/dataset/tests/ test/dataset/

* use path to get file path

* add dataset

* remove cmake entry

* add all ops

* solve conflicts
上级 a33a4d01
...@@ -149,7 +149,6 @@ add_custom_target(paddle_python ALL ...@@ -149,7 +149,6 @@ add_custom_target(paddle_python ALL
set(PADDLE_PYTHON_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/dist/) set(PADDLE_PYTHON_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/dist/)
if(WITH_TESTING) if(WITH_TESTING)
add_subdirectory(paddle/dataset/tests)
add_subdirectory(paddle/fluid/tests) add_subdirectory(paddle/fluid/tests)
add_subdirectory(paddle/static/quantization/tests) add_subdirectory(paddle/static/quantization/tests)
endif() endif()
......
py_test(test_image SRCS test_image.py)
...@@ -17,7 +17,7 @@ if(WITH_TESTING) ...@@ -17,7 +17,7 @@ if(WITH_TESTING)
add_subdirectory(custom_kernel) add_subdirectory(custom_kernel)
add_subdirectory(custom_op) add_subdirectory(custom_op)
# add_subdirectory(custom_runtime) # add_subdirectory(custom_runtime)
# 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)
......
file(
GLOB TEST_OPS
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"test_*.py")
string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}")
foreach(src ${TEST_OPS})
py_test(${src} SRCS ${src}.py)
endforeach()
...@@ -17,8 +17,7 @@ Fliename: ...@@ -17,8 +17,7 @@ Fliename:
Description: Description:
This scipt test image resize,flip and chw. This scipt test image resize,flip and chw.
""" """
import os
import sys
import unittest import unittest
import numpy as np import numpy as np
...@@ -35,7 +34,9 @@ class Image(unittest.TestCase): ...@@ -35,7 +34,9 @@ class Image(unittest.TestCase):
def test_resize_flip_chw(self): def test_resize_flip_chw(self):
"""resize""" """resize"""
imgdir = sys.argv[0].replace('test_image.py', 'cat.jpg') imgdir = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'cat.jpg'
)
images = image.load_image(imgdir) images = image.load_image(imgdir)
images = image.resize_short(images, 256) images = image.resize_short(images, 256)
self.assertEqual(256, min(images.shape[:2])) self.assertEqual(256, min(images.shape[:2]))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册