jorisvandenbossche commented on code in PR #41904:
URL: https://github.com/apache/arrow/pull/41904#discussion_r1698385824


##########
python/pyarrow/tests/test_cpp_internals.py:
##########
@@ -26,6 +31,10 @@ def inject_cpp_tests(ns):
     Inject C++ tests as Python functions into namespace `ns` (a dict).
     """
     for case in get_cpp_tests():
+        if np is None and ('numpy' in case.name or 'pandas' in case.name):
+            # Skip C++ tests that require pandas or numpy if numpy not present
+            continue

Review Comment:
   It might be this does not work for _selecting_ tests, though, because the 
marker is only added when running the test (it does work for xfailing or 
skipping). 
   
   So could either use that to skip the test directly (instead of through the 
`numpy` mark), or could also do something like the following (but that is more 
verbose):
   
   ```
   if 'numpy' in case.name:
   
       @pytest.mark.numpy
       def wrapper():
           case()
   
   else:
   
       def wrapper():
           case()
   ```
   
   In the end this is also a decorator, so maybe the following also works (not 
entirely sure this works this way as those pytest decorators are a bit magical 
..):
   
   ```
   def wrapper():
       case()
   
   if 'numpy' in case.name:
       wrapper = pytest.mark.numpy(wrapper)
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to