Skip to content

TST: CI checks against direct imports from conftest.py #33664

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

Merged

Conversation

SaturnFromTitan
Copy link
Contributor

@@ -150,7 +150,13 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
# Check for imports from pandas._testing instead of `import pandas._testing as tm`
invgrep -R --include="*.py*" -E "from pandas._testing import" pandas/tests
RET=$(($RET + $?)) ; echo $MSG "DONE"
invgrep -R --include="*.py*" -E "from pandas.util import testing as tm" pandas/tests
invgrep -R --include="*.py*" -E "from pandas import _testing as tm" pandas/tests
Copy link
Contributor Author

@SaturnFromTitan SaturnFromTitan Apr 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just converted this from util.testing to ._testing. Seems like this code check wasn't adapted to the new location of the testing module.

It's not related, but as the PR is tiny otherwise, I think it's ok to include it.

RET=$(($RET + $?)) ; echo $MSG "DONE"

# No direct imports from conftest
invgrep -R --include="*.py*" -E "conftest import" pandas/tests
Copy link
Contributor Author

@SaturnFromTitan SaturnFromTitan Apr 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using "conftest import" instead of "pandas.conftest import" to make it work for all conftest files

@SaturnFromTitan SaturnFromTitan changed the title added CI checks to avoid direct imports from conftest TST: added CI checks to avoid direct imports from conftest Apr 20, 2020
@SaturnFromTitan SaturnFromTitan added the Testing pandas testing functions or related to the test suite label Apr 20, 2020
@SaturnFromTitan SaturnFromTitan requested a review from jreback April 20, 2020 01:08
@SaturnFromTitan SaturnFromTitan changed the title TST: added CI checks to avoid direct imports from conftest TST: CI checks against direct imports from conftest.py Apr 20, 2020
@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Apr 20, 2020
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @SaturnFromTitan lgtm.

@simonjayhawkins simonjayhawkins added the Code Style Code style, linting, code_checks label Apr 20, 2020
@jreback jreback merged commit 7afb870 into pandas-dev:master Apr 20, 2020
@jreback
Copy link
Contributor

jreback commented Apr 20, 2020

thanks @SaturnFromTitan

rhshadrach pushed a commit to rhshadrach/pandas that referenced this pull request May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make a code check which bans imports of fixtures in tests
3 participants