Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyTest Warning #79

Closed
simon-mo opened this issue Sep 10, 2018 · 3 comments
Closed

PyTest Warning #79

simon-mo opened this issue Sep 10, 2018 · 3 comments
Labels
Code Quality 💯 Improvements or issues to improve quality of codebase

Comments

@simon-mo
Copy link
Collaborator

/usr/local/lib/python2.7/site-packages/_pytest/python.py:197: RemovedInPytest4Warning: Fixture "test_ndim" called directly. Fixtures are not meant to be called directly, are created automatically when test functions request them as parameters. See https://docs.pytest.org/en/latest/fixture.html for more information.

Our CI is giving us tons of these kind of warning. Worth investigating.

@thomasjpfan
Copy link
Contributor

This comes from the fact that functions decorated with @pytest.fixture were designed to be passed in as parameters:

@pytest.fixture
def one():
    return 1

def test_simple(one):
    assert one == 1

In the codebase there are fixtures such as:

@pytest.fixture
def test_copy(ray_df):
    ....

def test_mixed_dtype_dataframe():
    ....
    test_copy(ray_df)

One option to refactor this would be:

def assert_copy(ray_df):
    ....

def test_mixed_dtype_dataframe():
    ....
    assert_copy(ray_df)

@devin-petersohn
Copy link
Collaborator

@thomasjpfan Seems like a reasonable refactor. Once #70 gets merged, this can be done more effectively (and without rebasing issues).

@devin-petersohn devin-petersohn added the Code Quality 💯 Improvements or issues to improve quality of codebase label Sep 29, 2018
@devin-petersohn
Copy link
Collaborator

Resolved by #903

dchigarev pushed a commit to dchigarev/modin that referenced this issue Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Quality 💯 Improvements or issues to improve quality of codebase
Projects
None yet
Development

No branches or pull requests

3 participants