Skip to content

ARROW-17016: [C++][Python] Move Arrow Python C++ tests into Cython - #14117

Merged
pitrou merged 18 commits into
apache:masterfrom
AlenkaF:cython_test_example
Oct 3, 2022
Merged

ARROW-17016: [C++][Python] Move Arrow Python C++ tests into Cython#14117
pitrou merged 18 commits into
apache:masterfrom
AlenkaF:cython_test_example

Conversation

@AlenkaF

@AlenkaFAlenkaF commented Sep 14, 2022

Copy link
Copy Markdown
Member

This PR tries to connect the PyArrow C++ tests with PyArrow tests so they can all be run from pytest. This will remove GoogleTest as a dependency for PyArrow and therefore a change is needed in the C++ tests so they return a Status which can then be checked through Cython/Python.

Example of pytest run:

pyarrow/tests/test_cpp_internals.py::test_owned_ref_moves PASSED
pyarrow/tests/test_cpp_internals.py::test_owned_ref_nogil_moves PASSED
pyarrow/tests/test_cpp_internals.py::test_check_pyerror_status PASSED
pyarrow/tests/test_cpp_internals.py::test_check_pyerror_status_nogil PASSED
pyarrow/tests/test_cpp_internals.py::test_restore_pyerror_basics PASSED
pyarrow/tests/test_cpp_internals.py::test_pybuffer_invalid_input_object PASSED
pyarrow/tests/test_cpp_internals.py::test_pybuffer_numpy_array PASSED
pyarrow/tests/test_cpp_internals.py::test_numpybuffer_numpy_array PASSED
pyarrow/tests/test_cpp_internals.py::test_python_decimal_to_string PASSED
pyarrow/tests/test_cpp_internals.py::test_infer_precision_and_scale PASSED
pyarrow/tests/test_cpp_internals.py::test_infer_precision_and_negative_scale PASSED
pyarrow/tests/test_cpp_internals.py::test_infer_all_leading_zeros PASSED
pyarrow/tests/test_cpp_internals.py::test_infer_all_leading_zeros_exponential_notation_positive PASSED
pyarrow/tests/test_cpp_internals.py::test_infer_all_leading_zeros_exponential_notation_negative PASSED
pyarrow/tests/test_cpp_internals.py::test_object_block_write_fails PASSED
pyarrow/tests/test_cpp_internals.py::test_mixed_type_fails PASSED
pyarrow/tests/test_cpp_internals.py::test_from_python_decimal_rescale_not_truncateable PASSED
pyarrow/tests/test_cpp_internals.py::test_from_python_decimal_rescale_truncateable PASSED
pyarrow/tests/test_cpp_internals.py::test_from_python_negative_decimal_rescale PASSED
pyarrow/tests/test_cpp_internals.py::test_decimal128_from_python_integer PASSED
pyarrow/tests/test_cpp_internals.py::test_decimal256_from_python_integer PASSED
pyarrow/tests/test_cpp_internals.py::test_decimal128_overflow_fails PASSED
pyarrow/tests/test_cpp_internals.py::test_decimal256_overflow_fails PASSED
pyarrow/tests/test_cpp_internals.py::test_none_and_nan PASSED
pyarrow/tests/test_cpp_internals.py::test_mixed_precision_and_scale PASSED
pyarrow/tests/test_cpp_internals.py::test_mixed_precision_and_scale_sequence_convert PASSED
pyarrow/tests/test_cpp_internals.py::test_simple_inference PASSED
pyarrow/tests/test_cpp_internals.py::test_update_with_nan PASSED

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

Comment threadpython/pyarrow/src/python_test.cc Outdated

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some general comments. I will probably want to make some slight changes on the C++ side as well.

Comment threadpython/pyarrow/_pyarrow_cpp_tests.pxd Outdated
Comment threadpython/setup.cfg Outdated
Comment threadpython/pyarrow/tests/test_python.py Outdated
@AlenkaF

Copy link
Copy Markdown
MemberAuthor

Should we wait for ARROW-17843 so that the PyArrow C++ code is checked or we can correct that within the linter issue itself?

@pitrou

Copy link
Copy Markdown
Member

We can correct the C++ linting later IMHO.

@AlenkaF
AlenkaF marked this pull request as ready for review September 27, 2022 10:10
@AlenkaF

Copy link
Copy Markdown
MemberAuthor

The failures on the CI are not new, have seen them on the nightly builds.

I think this PR is ready, totally approved from my side :)
@pitrou did you have any other corrections in mind?

@jorisvandenbossche

Copy link
Copy Markdown
Member

@AlenkaF can you merge in or rebase on latest master? That should resolve those CI failures

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, thank you very much for doing this @AlenkaF !

@pitrou

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g python -g wheel

@github-actions

Copy link
Copy Markdown

Revision: 7e4e2e653d8ce24cb3d8961fb386881114fda126

Submitted crossbow builds: ursacomputing/crossbow @ actions-6dfbce193c

TaskStatus
test-conda-python-3.10Github Actions
test-conda-python-3.7Github Actions
test-conda-python-3.7-hdfs-2.9.2Github Actions
test-conda-python-3.7-hdfs-3.2.1Github Actions
test-conda-python-3.7-kartothek-latestGithub Actions
test-conda-python-3.7-kartothek-masterGithub Actions
test-conda-python-3.7-pandas-0.24Github Actions
test-conda-python-3.7-pandas-latestGithub Actions
test-conda-python-3.7-spark-v3.1.2Github Actions
test-conda-python-3.8Github Actions
test-conda-python-3.8-hypothesisGithub Actions
test-conda-python-3.8-pandas-latestGithub Actions
test-conda-python-3.8-pandas-nightlyGithub Actions
test-conda-python-3.8-spark-v3.2.0Github Actions
test-conda-python-3.9Github Actions
test-conda-python-3.9-dask-latestGithub Actions
test-conda-python-3.9-dask-masterGithub Actions
test-conda-python-3.9-pandas-masterGithub Actions
test-conda-python-3.9-spark-masterGithub Actions
test-debian-11-python-3Azure
test-fedora-35-python-3Azure
test-ubuntu-20.04-python-3Azure
wheel-macos-big-sur-cp310-arm64Github Actions
wheel-macos-big-sur-cp310-universal2Github Actions
wheel-macos-big-sur-cp38-arm64Github Actions
wheel-macos-big-sur-cp39-arm64Github Actions
wheel-macos-big-sur-cp39-universal2Github Actions
wheel-macos-mojave-cp310-amd64Github Actions
wheel-macos-mojave-cp37-amd64Github Actions
wheel-macos-mojave-cp38-amd64Github Actions
wheel-macos-mojave-cp39-amd64Github Actions
wheel-manylinux2014-cp310-amd64Github Actions
wheel-manylinux2014-cp310-arm64TravisCI
wheel-manylinux2014-cp37-amd64Github Actions
wheel-manylinux2014-cp37-arm64TravisCI
wheel-manylinux2014-cp38-amd64Github Actions
wheel-manylinux2014-cp38-arm64TravisCI
wheel-manylinux2014-cp39-amd64Github Actions
wheel-manylinux2014-cp39-arm64TravisCI
wheel-windows-cp310-amd64Github Actions
wheel-windows-cp37-amd64Github Actions
wheel-windows-cp38-amd64Github Actions
wheel-windows-cp39-amd64Github Actions

@AlenkaF

Copy link
Copy Markdown
MemberAuthor

I think the failures of the wheels are related to the fact that ARROW_PYTHON is not set anymore and so for example csv module is not build and not found by PyArrow (ARROW_CSV=OFF).

@pitrou

Copy link
Copy Markdown
Member

Yes, we will probably need to enable all desired components manually.

@jorisvandenbossche

Copy link
Copy Markdown
Member

Yes, that is getting fixed in #14273

@AlenkaF

Copy link
Copy Markdown
MemberAuthor

You think I should wait for #14273 to get merged and then rebase?

@AlenkaF
AlenkaFforce-pushed the cython_test_example branch from 7e4e2e6 to be21035CompareOctober 3, 2022 04:04
@AlenkaF

AlenkaF commented Oct 3, 2022

Copy link
Copy Markdown
MemberAuthor

@pitrou@jorisvandenbossche this PR is now ready for final round of review/merge.

@jorisvandenbossche

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g python -g wheel

@github-actions

Copy link
Copy Markdown

Revision: be21035

Submitted crossbow builds: ursacomputing/crossbow @ actions-f48ddf2e66

TaskStatus
test-conda-python-3.10Github Actions
test-conda-python-3.7Github Actions
test-conda-python-3.7-hdfs-2.9.2Github Actions
test-conda-python-3.7-hdfs-3.2.1Github Actions
test-conda-python-3.7-pandas-0.24Github Actions
test-conda-python-3.7-pandas-latestGithub Actions
test-conda-python-3.7-spark-v3.1.2Github Actions
test-conda-python-3.8Github Actions
test-conda-python-3.8-hypothesisGithub Actions
test-conda-python-3.8-pandas-latestGithub Actions
test-conda-python-3.8-pandas-nightlyGithub Actions
test-conda-python-3.8-spark-v3.2.0Github Actions
test-conda-python-3.9Github Actions
test-conda-python-3.9-dask-latestGithub Actions
test-conda-python-3.9-dask-masterGithub Actions
test-conda-python-3.9-pandas-masterGithub Actions
test-conda-python-3.9-spark-masterGithub Actions
test-debian-11-python-3Azure
test-fedora-35-python-3Azure
test-ubuntu-20.04-python-3Azure
wheel-macos-big-sur-cp310-arm64Github Actions
wheel-macos-big-sur-cp310-universal2Github Actions
wheel-macos-big-sur-cp38-arm64Github Actions
wheel-macos-big-sur-cp39-arm64Github Actions
wheel-macos-big-sur-cp39-universal2Github Actions
wheel-macos-mojave-cp310-amd64Github Actions
wheel-macos-mojave-cp37-amd64Github Actions
wheel-macos-mojave-cp38-amd64Github Actions
wheel-macos-mojave-cp39-amd64Github Actions
wheel-manylinux2014-cp310-amd64Github Actions
wheel-manylinux2014-cp310-arm64TravisCI
wheel-manylinux2014-cp37-amd64Github Actions
wheel-manylinux2014-cp37-arm64TravisCI
wheel-manylinux2014-cp38-amd64Github Actions
wheel-manylinux2014-cp38-arm64TravisCI
wheel-manylinux2014-cp39-amd64Github Actions
wheel-manylinux2014-cp39-arm64TravisCI
wheel-windows-cp310-amd64Github Actions
wheel-windows-cp37-amd64Github Actions
wheel-windows-cp38-amd64Github Actions
wheel-windows-cp39-amd64Github Actions

@pitrou

Copy link
Copy Markdown
Member

Nothing seems to have changed since my last review, so I'm simply gonna merge!

@AlenkaF

Copy link
Copy Markdown
MemberAuthor

Thank you for running the wheels build - totally forgot that was what I was waiting to check :)

@pitrou
pitrou merged commit 5fd54bc into apache:masterOct 3, 2022
@AlenkaF
AlenkaF deleted the cython_test_example branch October 3, 2022 16:45
@ursabot

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = 441af34 and contender = 5fd54bc. 5fd54bc is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.0% ⬆️0.0%] test-mac-arm
[Failed ⬇️0.82% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.46% ⬆️0.04%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 5fd54bc6 ec2-t3-xlarge-us-east-2
[Failed] 5fd54bc6 test-mac-arm
[Failed] 5fd54bc6 ursa-i9-9960x
[Finished] 5fd54bc6 ursa-thinkcentre-m75q
[Finished] 441af348 ec2-t3-xlarge-us-east-2
[Failed] 441af348 test-mac-arm
[Failed] 441af348 ursa-i9-9960x
[Finished] 441af348 ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@ursabot

Copy link
Copy Markdown

['Python', 'R'] benchmarks have high level of regressions.
ursa-i9-9960x

pitrou pushed a commit that referenced this pull request Oct 17, 2022
…14435)
As #14117 is merged separate run of `ctest` for `PyArrow C++` tests is not needed anymore and is removed in this PR.
Authored-by: Alenka Frim <frim.alenka@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
jorisvandenbossche pushed a commit that referenced this pull request Oct 19, 2022
…pers/python page (#14350)
This PR updates Windows section of the Python Development page. Main changes:
- use Python 3.10 (also in instructions for Linux/MacOs)
- definition of `PATH` not needed as Python doesn't search in `PATH` for dlls anymore ([3.8 +](https://bugs.python.org/issue43173))
- use `CONDA_PREFIX` to define `ARROW_HOME` as in other parts of the docs
- remove **Running C++ unit tests for Python integration** section (C++ unit tests are part of `pytest`-based test module as of #14117)
cc @wjones127@jorisvandenbossche Authored-by: Alenka Frim <frim.alenka@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
kou pushed a commit that referenced this pull request Oct 20, 2022
…14435)
As #14117 is merged separate run of `ctest` for `PyArrow C++` tests is not needed anymore and is removed in this PR.
Authored-by: Alenka Frim <frim.alenka@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
kou pushed a commit that referenced this pull request Oct 20, 2022
…pers/python page (#14350)
This PR updates Windows section of the Python Development page. Main changes:
- use Python 3.10 (also in instructions for Linux/MacOs)
- definition of `PATH` not needed as Python doesn't search in `PATH` for dlls anymore ([3.8 +](https://bugs.python.org/issue43173))
- use `CONDA_PREFIX` to define `ARROW_HOME` as in other parts of the docs
- remove **Running C++ unit tests for Python integration** section (C++ unit tests are part of `pytest`-based test module as of #14117)
cc @wjones127@jorisvandenbossche Authored-by: Alenka Frim <frim.alenka@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
kevingurney added a commit that referenced this pull request Sep 19, 2023
…ke build system for the MATLAB interface (#37784)
### Rationale for this change
This pull request removes `GoogleTest` support from the CMake build system for the MATLAB interface.
1. `GoogleTest` support adds a lot of additional complexity to the CMake build system for the MATLAB interface, and we currently don't have any standalone C++ tests for the MATLAB interface code.
2. In order to use `GoogleTest` in the MATLAB CI workflows, we are currently relying on building the tests for the Arrow C++ libraries in order to "re-use" the `GoogleTest binaries. This adds additional overhead to the MATLAB CI workflows.
3. If we want to test some internal C++ code for the MATLAB interface in the future, we can instead use a MEX function to call the code from a MATLAB test as suggested by @ kou in #37532 (comment).
4. There is [precedent for testing internal C++ code without GoogleTest for the Python bindings](#14117).
5. On a somewhat related note - removing `GoogleTest` support will help unblock #37773 as discussed in #37773 (comment).
### What changes are included in this PR?
1. Removed the `MATLAB_BUILD_TESTS` flag from the CMake build system for the MATLAB interface since there are no longer any C++ tests for the MATLAB interface to build.
2. Updated the `matlab_build.sh` CI workflow script to avoid building the tests for the Arrow C++ libraries and to no longer call `ctest`.
3. Updated the `README.md` for the MATLAB interface to no longer mention building or running C++ tests.
4. Updated the design document for the MATLAB Interface to no longer mention `GoogleTest` since we may end up testing internal C++ code using MEX function calls from MATLAB instead.
5. Removed placeholder C++ test (i.e. `placeholder_test.cc`).
### Are these changes tested?
Yes.
The MATLAB CI workflow is passing on all platforms.
### Are there any user-facing changes?
Yes.
There are no longer any C++ tests for the MATLAB interface. The `MATLAB_BUILD_TESTS` flag has been removed from the CMake build system to reflect this change. If a user supplies a value for `MATLAB_BUILD_TESTS` when building the MATLAB interface, the flag will be ignored by CMake.
### Future Directions
1. Add more developer-focused documentation on how to test C++ code via MEX function calls from MATLAB.
### Notes
1. In the future, we can consider testing internal C++ code using MEX function calls from MATLAB tests as suggested by @ kou in #37532 (comment). Currently, we don't have any C++ tests that need to be adapted to use this approach.
2. Thank you @ sgilmore10 for your help with this pull request!
* Closes: #37532
Lead-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…he CMake build system for the MATLAB interface (apache#37784)
### Rationale for this change
This pull request removes `GoogleTest` support from the CMake build system for the MATLAB interface.
1. `GoogleTest` support adds a lot of additional complexity to the CMake build system for the MATLAB interface, and we currently don't have any standalone C++ tests for the MATLAB interface code.
2. In order to use `GoogleTest` in the MATLAB CI workflows, we are currently relying on building the tests for the Arrow C++ libraries in order to "re-use" the `GoogleTest binaries. This adds additional overhead to the MATLAB CI workflows.
3. If we want to test some internal C++ code for the MATLAB interface in the future, we can instead use a MEX function to call the code from a MATLAB test as suggested by @ kou in apache#37532 (comment).
4. There is [precedent for testing internal C++ code without GoogleTest for the Python bindings](apache#14117).
5. On a somewhat related note - removing `GoogleTest` support will help unblock apache#37773 as discussed in apache#37773 (comment).
### What changes are included in this PR?
1. Removed the `MATLAB_BUILD_TESTS` flag from the CMake build system for the MATLAB interface since there are no longer any C++ tests for the MATLAB interface to build.
2. Updated the `matlab_build.sh` CI workflow script to avoid building the tests for the Arrow C++ libraries and to no longer call `ctest`.
3. Updated the `README.md` for the MATLAB interface to no longer mention building or running C++ tests.
4. Updated the design document for the MATLAB Interface to no longer mention `GoogleTest` since we may end up testing internal C++ code using MEX function calls from MATLAB instead.
5. Removed placeholder C++ test (i.e. `placeholder_test.cc`).
### Are these changes tested?
Yes.
The MATLAB CI workflow is passing on all platforms.
### Are there any user-facing changes?
Yes.
There are no longer any C++ tests for the MATLAB interface. The `MATLAB_BUILD_TESTS` flag has been removed from the CMake build system to reflect this change. If a user supplies a value for `MATLAB_BUILD_TESTS` when building the MATLAB interface, the flag will be ignored by CMake.
### Future Directions
1. Add more developer-focused documentation on how to test C++ code via MEX function calls from MATLAB.
### Notes
1. In the future, we can consider testing internal C++ code using MEX function calls from MATLAB tests as suggested by @ kou in apache#37532 (comment). Currently, we don't have any C++ tests that need to be adapted to use this approach.
2. Thank you @ sgilmore10 for your help with this pull request!
* Closes: apache#37532
Lead-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…he CMake build system for the MATLAB interface (apache#37784)
### Rationale for this change
This pull request removes `GoogleTest` support from the CMake build system for the MATLAB interface.
1. `GoogleTest` support adds a lot of additional complexity to the CMake build system for the MATLAB interface, and we currently don't have any standalone C++ tests for the MATLAB interface code.
2. In order to use `GoogleTest` in the MATLAB CI workflows, we are currently relying on building the tests for the Arrow C++ libraries in order to "re-use" the `GoogleTest binaries. This adds additional overhead to the MATLAB CI workflows.
3. If we want to test some internal C++ code for the MATLAB interface in the future, we can instead use a MEX function to call the code from a MATLAB test as suggested by @ kou in apache#37532 (comment).
4. There is [precedent for testing internal C++ code without GoogleTest for the Python bindings](apache#14117).
5. On a somewhat related note - removing `GoogleTest` support will help unblock apache#37773 as discussed in apache#37773 (comment).
### What changes are included in this PR?
1. Removed the `MATLAB_BUILD_TESTS` flag from the CMake build system for the MATLAB interface since there are no longer any C++ tests for the MATLAB interface to build.
2. Updated the `matlab_build.sh` CI workflow script to avoid building the tests for the Arrow C++ libraries and to no longer call `ctest`.
3. Updated the `README.md` for the MATLAB interface to no longer mention building or running C++ tests.
4. Updated the design document for the MATLAB Interface to no longer mention `GoogleTest` since we may end up testing internal C++ code using MEX function calls from MATLAB instead.
5. Removed placeholder C++ test (i.e. `placeholder_test.cc`).
### Are these changes tested?
Yes.
The MATLAB CI workflow is passing on all platforms.
### Are there any user-facing changes?
Yes.
There are no longer any C++ tests for the MATLAB interface. The `MATLAB_BUILD_TESTS` flag has been removed from the CMake build system to reflect this change. If a user supplies a value for `MATLAB_BUILD_TESTS` when building the MATLAB interface, the flag will be ignored by CMake.
### Future Directions
1. Add more developer-focused documentation on how to test C++ code via MEX function calls from MATLAB.
### Notes
1. In the future, we can consider testing internal C++ code using MEX function calls from MATLAB tests as suggested by @ kou in apache#37532 (comment). Currently, we don't have any C++ tests that need to be adapted to use this approach.
2. Thank you @ sgilmore10 for your help with this pull request!
* Closes: apache#37532
Lead-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@AlenkaF@pitrou@jorisvandenbossche@ursabot