Skip to content

Commit bf57f31

Browse files
Use package_data instead of data_files in setup.py to pack tests
1 parent c7d3811 commit bf57f31

File tree

1 file changed

+4
-31
lines changed

1 file changed

+4
-31
lines changed

setup.py

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -46,36 +46,6 @@ def _get_cmdclass():
4646
Operating System :: Unix
4747
"""
4848

49-
EXCLUDED_DIRS = ["tests_perf"]
50-
51-
52-
def find_tests_files():
53-
files_by_destination = {}
54-
for root, dirs, files in os.walk("tests"):
55-
# Exclude specified directories
56-
dirs[:] = [dir for dir in dirs if dir not in EXCLUDED_DIRS]
57-
58-
for file in files:
59-
file_path = os.path.join(root, file)
60-
# Get the path relative to `tests`` to keep folder structure
61-
relative_path = os.path.relpath(file_path, "tests")
62-
destination = os.path.join(
63-
"dpnp/tests", os.path.dirname(relative_path)
64-
)
65-
66-
# Add the file to the correct destination folder in the dictionary
67-
if destination not in files_by_destination:
68-
files_by_destination[destination] = []
69-
files_by_destination[destination].append(file_path)
70-
71-
# Convert the dictionary to the format expected by data_files:
72-
# [(destination_folder, [list_of_files])]
73-
tests_files = [
74-
(dest, files) for dest, files in files_by_destination.items()
75-
]
76-
77-
return tests_files
78-
7949

8050
setup(
8151
name="dpnp",
@@ -98,13 +68,16 @@ def find_tests_files():
9868
"dpnp.linalg",
9969
"dpnp.random",
10070
],
101-
data_files=find_tests_files(),
10271
package_data={
10372
"dpnp": [
10473
"backend/include/*.hpp",
10574
"libdpnp_backend_c.so",
10675
"dpnp_backend_c.lib",
10776
"dpnp_backend_c.dll",
77+
"tests/*.*",
78+
"tests/testing/*.py",
79+
"tests/third_party/cupy/*.py",
80+
"tests/third_party/cupy/*/*.py",
10881
]
10982
},
11083
include_package_data=False,

0 commit comments

Comments
 (0)