diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 241f1fb0300ccd658a958041333e583faab191fe..05e41642a2cd3a2b9f25180714c55799f59ad457 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -149,7 +149,6 @@ add_custom_target(paddle_python ALL set(PADDLE_PYTHON_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/dist/) if(WITH_TESTING) - add_subdirectory(paddle/dataset/tests) add_subdirectory(paddle/fluid/tests) add_subdirectory(paddle/static/quantization/tests) endif() diff --git a/python/paddle/dataset/tests/CMakeLists.txt b/python/paddle/dataset/tests/CMakeLists.txt deleted file mode 100644 index 485c38a13b573664d8033c237272a10ebb7c9701..0000000000000000000000000000000000000000 --- a/python/paddle/dataset/tests/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -py_test(test_image SRCS test_image.py) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 37623567d2214d9570357523f84f0e0618779fe7..60d05fbdf5715670bd16b64721a11d94dbb35c08 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -17,7 +17,7 @@ if(WITH_TESTING) add_subdirectory(custom_kernel) add_subdirectory(custom_op) # add_subdirectory(custom_runtime) - # add_subdirectory(dataset) + add_subdirectory(dataset) # add_subdirectory(distributed_passes) # add_subdirectory(distribution) # add_subdirectory(dygraph_to_static) diff --git a/test/dataset/CMakeLists.txt b/test/dataset/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec4cf735704565bc4a88dd291eb94c4343fd83b9 --- /dev/null +++ b/test/dataset/CMakeLists.txt @@ -0,0 +1,9 @@ +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() diff --git a/python/paddle/dataset/tests/cat.jpg b/test/dataset/cat.jpg similarity index 100% rename from python/paddle/dataset/tests/cat.jpg rename to test/dataset/cat.jpg diff --git a/python/paddle/dataset/tests/cifar_test.py b/test/dataset/cifar_test.py similarity index 100% rename from python/paddle/dataset/tests/cifar_test.py rename to test/dataset/cifar_test.py diff --git a/python/paddle/dataset/tests/flowers_test.py b/test/dataset/flowers_test.py similarity index 100% rename from python/paddle/dataset/tests/flowers_test.py rename to test/dataset/flowers_test.py diff --git a/python/paddle/dataset/tests/imdb_test.py b/test/dataset/imdb_test.py similarity index 100% rename from python/paddle/dataset/tests/imdb_test.py rename to test/dataset/imdb_test.py diff --git a/python/paddle/dataset/tests/imikolov_test.py b/test/dataset/imikolov_test.py similarity index 100% rename from python/paddle/dataset/tests/imikolov_test.py rename to test/dataset/imikolov_test.py diff --git a/python/paddle/dataset/tests/mnist_test.py b/test/dataset/mnist_test.py similarity index 100% rename from python/paddle/dataset/tests/mnist_test.py rename to test/dataset/mnist_test.py diff --git a/python/paddle/dataset/tests/test_image.py b/test/dataset/test_image.py similarity index 93% rename from python/paddle/dataset/tests/test_image.py rename to test/dataset/test_image.py index 8656ef2669bfa8581d793f224b5b5564d4f22862..54858da9da123ed3f7f5f85722a0a8939304b564 100644 --- a/python/paddle/dataset/tests/test_image.py +++ b/test/dataset/test_image.py @@ -17,8 +17,7 @@ Fliename: Description: This scipt test image resize,flip and chw. """ - -import sys +import os import unittest import numpy as np @@ -35,7 +34,9 @@ class Image(unittest.TestCase): def test_resize_flip_chw(self): """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.resize_short(images, 256) self.assertEqual(256, min(images.shape[:2])) diff --git a/python/paddle/dataset/tests/voc2012_test.py b/test/dataset/voc2012_test.py similarity index 100% rename from python/paddle/dataset/tests/voc2012_test.py rename to test/dataset/voc2012_test.py diff --git a/python/paddle/dataset/tests/wmt16_test.py b/test/dataset/wmt16_test.py similarity index 100% rename from python/paddle/dataset/tests/wmt16_test.py rename to test/dataset/wmt16_test.py