Skip to content

TST/PKG: Remove definition pandas.util.testing.slow #16850

Closed
@TomAugspurger

Description

@TomAugspurger

And just use pytest.mark.slow where needed. Defining the fixture at the top-level there causes problems for projects that import pandas and use the --strict flag for pytest.

$ echo "import pandas" > test_pandas.py
$ pytest test_pandas.py --strict

====================================================== ERRORS ======================================================
_________________________________________ ERROR collecting test_pandas.py __________________________________________
test_pandas.py:1: in <module>
    import pandas
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/__init__.py:60: in <module>
    import pandas.testing
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/testing.py:7: in <module>
    from pandas.util.testing import (
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/util/testing.py:55: in <module>
    slow = pytest.mark.slow
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/_pytest/mark.py:251: in __getattr__
    self._check(name)
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/_pytest/mark.py:266: in _check
    raise AttributeError("%r not a registered marker" % (name,))
E   AttributeError: 'slow' not a registered marker
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================= 1 error in 1.29 seconds ==============================================

By replacing usages of @slow with @pytest.mark.slow, the error is not raised.

The alternative is to register a setuptools entrypoint that exposes the slow marker. I don't think this is desirable, since AFAIK, there's no namespacing on pytest plugins. It doesn't make since for pandas to claim that, since we aren't a pytest plugin really.

I'm marking this for 0.21.0, since it's possible people were using the @slow decorator in their own tests. I'll do some searching.

xref #16680 (comment) and #16797

cc @koffie

Metadata

Metadata

Assignees

No one assigned

    Labels

    Testingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions