Skip to content

Commit 8b89147

Browse files
authored
ARROW-17389: [Python] Properly exclude tests when PYARROW_INSTALL_TESTS=0 (#13904)
Authored-by: Miles Granger <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
1 parent 9882df5 commit 8b89147

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎python/setup.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,14 @@ def has_ext_modules(foo):
622622

623623
if strtobool(os.environ.get('PYARROW_INSTALL_TESTS', '1')):
624624
packages = find_namespace_packages(include=['pyarrow*'])
625+
exclude_package_data = {}
625626
else:
626627
packages = find_namespace_packages(include=['pyarrow*'],
627628
exclude=["pyarrow.tests*"])
629+
# setuptools adds back importable packages even when excluded.
630+
# https://github.com/pypa/setuptools/issues/3260
631+
# https://github.com/pypa/setuptools/issues/3340#issuecomment-1219383976
632+
exclude_package_data = {"pyarrow": ["tests*"]}
628633

629634

630635
setup(
@@ -633,6 +638,7 @@ def has_ext_modules(foo):
633638
zip_safe=False,
634639
package_data={'pyarrow': ['*.pxd', '*.pyx', 'includes/*.pxd']},
635640
include_package_data=True,
641+
exclude_package_data=exclude_package_data,
636642
distclass=BinaryDistribution,
637643
# Dummy extension to trigger build_ext
638644
ext_modules=[Extension('__dummy__', sources=[])],

0 commit comments

Comments
 (0)