spatialpandas icon indicating copy to clipboard operation
spatialpandas copied to clipboard

Only allow named extension array tests

Open ianthomas23 opened this issue 2 years ago • 2 comments

This is a possible (temporary?) fix to the problem of new pandas versions including new extension array tests that break our CI. The fix is to only run extension array tests with particular names, so the creation of a new test will not cause our existing CI to fail.

The solution isn't very elegant and I'm not sure I really like it, but it does fix the problem.

ianthomas23 avatar Jun 23 '22 14:06 ianthomas23

When you run pytest any extension array tests that are not included in the appropriate sequence are skipped as follows:

$ pytest spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface
========================================================= test session starts ==========================================================
platform linux -- Python 3.8.10, pytest-7.1.2, pluggy-1.0.0 -- /home/iant/.venv/sp/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/iant/github/spatialpandas/.hypothesis/examples')
rootdir: /home/iant/github/spatialpandas, configfile: tox.ini
plugins: cov-3.0.0, hypothesis-6.47.3
collected 14 items                                                                                                                     

spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_len PASSED                                          [  7%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_size PASSED                                         [ 14%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_ndim PASSED                                         [ 21%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_can_hold_na_valid PASSED                            [ 28%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_contains SKIPPED (Not in "only_run_named_tests")    [ 35%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_memory_usage PASSED                                 [ 42%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_array_interface PASSED                              [ 50%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_is_extension_array_dtype PASSED                     [ 57%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_no_values_attribute PASSED                          [ 64%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_is_numeric_honored PASSED                           [ 71%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_isna_extension_array PASSED                         [ 78%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_copy SKIPPED (Not in "only_run_named_tests")        [ 85%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_view SKIPPED (Not in "only_run_named_tests")        [ 92%]
spatialpandas/tests/test_fixedextensionarray.py::TestGeometryInterface::test_tolist PASSED                                       [100%]

=========================================================== warnings summary ===========================================================
spatialpandas/tests/test_fixedextensionarray.py: 11 warnings
  /home/iant/github/spatialpandas/spatialpandas/geometry/basefixed.py:111: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
    array = np.asarray(array)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================== 11 passed, 3 skipped, 11 warnings in 0.47s ==============================================

ianthomas23 avatar Jun 23 '22 14:06 ianthomas23

@jbednar Maybe we hold off merging this for the moment and keep it in reserve whilst I fix the other CI problems.

ianthomas23 avatar Jun 27 '22 14:06 ianthomas23