You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/15 10:22:11 UTC

[GitHub] [arrow] jorisvandenbossche commented on a change in pull request #12375: ARROW-15347: [Doc][Guide] Testing

jorisvandenbossche commented on a change in pull request #12375:
URL: https://github.com/apache/arrow/pull/12375#discussion_r806669311



##########
File path: docs/source/developers/guide/step_by_step/building.rst
##########
@@ -144,6 +146,27 @@ Building other Arrow libraries
 
          - :ref:`build_pyarrow_win`
 
+      When you will make change to the code, you may need to recompile
+      PyArrow or Arrow C++:
+
+      **Recompiling Cython**
+
+      If you only make changes to `.py` files, you do not need to

Review comment:
       ```suggestion
         If you only make changes to ``.py`` files, you do not need to
   ```
   
   (and the same for the cases on the line below)

##########
File path: docs/source/developers/guide/step_by_step/testing.rst
##########
@@ -34,13 +34,42 @@ In this section we outline steps needed for unit testing in Arrow.
 
 .. tabs::
 
-   .. tab:: Pytest
+   .. tab:: PyArrow
 
       We use `pytest <https://docs.pytest.org/en/latest/>`_ for
       unit tests in Python. For more info about the required
-      packages follow
+      packages see
       :ref:`Python unit testing section <python-unit-testing>`.
 
+      **Structure**
+
+      Test layout in PyArrow follows ``pytest`` structure for
+      `Tests as part of application code <https://docs.pytest.org/en/6.2.x/goodpractices.html#tests-as-part-of-application-code>`_:
+
+      .. code:: console
+
+         pyarrow/
+             __init__.py
+             csv.py
+             dataset.py
+             ...
+             tests/
+                 __init__.py
+                 test_csv.py
+                 test_dataset.py
+                 ...
+
+      Tests for Parquet are located in a separate folder ``pyarrow/tests/parquet/``.
+
+      .. Note::
+
+         Good to read:
+         `Invoking pytest versus python -m pytest <https://docs.pytest.org/en/6.2.x/pythonpath.html#pytest-vs-python-m-pytest>`_
+         (bottom of the page).

Review comment:
       I am wondering if we should give here a takeaway for our contributors? Or is there not a simple one? (I personally always use `pytest ..`, and not `python -m pytest` out of habit, and didn't run into problems with my current setup)

##########
File path: docs/source/developers/guide/step_by_step/testing.rst
##########
@@ -60,34 +89,44 @@ In this section we outline steps needed for unit testing in Arrow.
 
          $ python -m pytest pyarrow
 
-      If the tests start failing, try to recompile
-      PyArrow or C++.
-
-      .. note::
+      **Recompiling PyArrow or Arrow C++**
 
-         **Recompiling Cython**
+      If the tests start failing, try to recompile PyArrow or
+      Arrow C++. See note in the :ref:`build_libraries_guide`
+      section under the PyArrow tab.
 
-         If you only make changes to `.py` files, you do not need to
-         recompile PyArrow. However, you should recompile it if you make
-         changes in `.pyx` or `.pxd` files.
+      **Fixtures**
 
-         To do that run this command again:
+      Inside pPyArrow tests files there can be helper functions
+      and fixtures defined. Also other pytest decorators such as
+      ``@parametrize`` or ``@skipif`` are used.
 
-         .. code:: console
+      For example:
 
-            $ python setup.py build_ext --inplace
+      * ``_alltypes_example`` in ``test_pandas`` supplies a
+        dataframe with 100 rows for all data types.
+      * ``_check_pandas_roundtrip`` in ``test_pandas`` asserts if the
+        roundtrip from ``Pandas`` through ``pa.Table`` or
+        ``pa.RecordBatch`` back to ``Pandas`` yields the same result.
+      * ``large_buffer`` fixture supplying a PyArrow buffer of fixed
+        size to the function ``test_primitive_serialization(large_buffer)``
+        in ``test_serialization.py``.
 
-      .. note::
+      For this reason it is good to look through the file you
+      are planning to add the tests to and see if any of
+      the defined functions or fixtures will be helpful.
 
-         **Recompiling C++**
+      For more information about ``pytest`` in general visit
+      `Full pytest documentation <https://docs.pytest.org/en/6.2.x/contents.html>`_

Review comment:
       ```suggestion
         `Full pytest documentation <https://docs.pytest.org/en/stable/contents.html>`_
   ```
   
   (then the link doesn't get outdated)

##########
File path: docs/source/developers/guide/step_by_step/testing.rst
##########
@@ -34,13 +34,42 @@ In this section we outline steps needed for unit testing in Arrow.
 
 .. tabs::
 
-   .. tab:: Pytest
+   .. tab:: PyArrow
 
       We use `pytest <https://docs.pytest.org/en/latest/>`_ for
       unit tests in Python. For more info about the required
-      packages follow
+      packages see
       :ref:`Python unit testing section <python-unit-testing>`.
 
+      **Structure**
+
+      Test layout in PyArrow follows ``pytest`` structure for
+      `Tests as part of application code <https://docs.pytest.org/en/6.2.x/goodpractices.html#tests-as-part-of-application-code>`_:
+
+      .. code:: console

Review comment:
       ```suggestion
         .. code::
   ```

##########
File path: docs/source/developers/guide/step_by_step/testing.rst
##########
@@ -60,34 +89,44 @@ In this section we outline steps needed for unit testing in Arrow.
 
          $ python -m pytest pyarrow
 
-      If the tests start failing, try to recompile
-      PyArrow or C++.
-
-      .. note::
+      **Recompiling PyArrow or Arrow C++**
 
-         **Recompiling Cython**
+      If the tests start failing, try to recompile PyArrow or
+      Arrow C++. See note in the :ref:`build_libraries_guide`
+      section under the PyArrow tab.
 
-         If you only make changes to `.py` files, you do not need to
-         recompile PyArrow. However, you should recompile it if you make
-         changes in `.pyx` or `.pxd` files.
+      **Fixtures**
 
-         To do that run this command again:
+      Inside pPyArrow tests files there can be helper functions

Review comment:
       ```suggestion
         Inside PyArrow test files there can be helper functions
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org