Skip to content

REF: dont pass exception to check_opname #54365

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
merged 13 commits into from
Aug 4, 2023

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.


def get_expected_exception(
self, op_name: str, obj, other
) -> type[Exception] | None:
Copy link
Member Author

Choose a reason for hiding this comment

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

could follow up by allowing authors to specify the exception message here

@jbrockmendel
Copy link
Member Author

I have no idea why the scripts test is failing

@mroeschke
Copy link
Member

I have no idea why the scripts test is failing

cc @MarcoGorelli

@MarcoGorelli
Copy link
Member

sorry about that, will take a look tomorrow - feel free to xfail/remove/ignore for now

@jbrockmendel
Copy link
Member Author

troubleshooting this, reverting the edits to tests.extension.base.ops fixes the script failure. reverting all the edits other than that file does not fix it. i still dont see any connection between that and the scripts test.

@mroeschke
Copy link
Member

troubleshooting this, reverting the edits to tests.extension.base.ops fixes the script failure. reverting all the edits other than that file does not fix it. i still dont see any connection between that and the scripts test.

I don't think the pre-commit check in check-test-naming is working correctly.

pre-commit isn't catching the violation but pytest scripts/tests/test_check_test_naming.py is because it has examples that trigger a for _file in (Path("pandas") / "tests").rglob("*.py") check.

@jbrockmendel
Copy link
Member Author

so should running the script manually catch a problem in tests.extension.base?

@jbrockmendel
Copy link
Member Author

The scripts/tests that are failing are ones that are hard-coded in the parametrization in test_check_test_naming

@mroeschke
Copy link
Member

This fixes the tests locally for me

diff --git a/pandas/tests/extension/base/ops.py b/pandas/tests/extension/base/ops.py
index 86e01dc240..58da0430d5 100644
--- a/pandas/tests/extension/base/ops.py
+++ b/pandas/tests/extension/base/ops.py
@@ -22,7 +22,7 @@ class BaseOpsUtil(BaseExtensionTests):
         # Find the Exception, if any we expect to raise calling
         #  obj.__op_name__(other)
 
-        # The self.foo_bar_exc pattern isn't great in part because it can depend
+        # The self.obj_bar_exc pattern isn't great in part because it can depend

I think the test cases self.foo matched your comment.

This is besides the fact that scripts/tests/test_check_test_naming.py should not be globbing pandas/tests

@jbrockmendel
Copy link
Member Author

Yep that fixed it. Thanks.

@mroeschke
Copy link
Member

pylint...................................................................Failed
- hook id: pylint
- duration: 607.66s
- exit code: 8

************* Module pandas.tests.extension.test_arrow
pandas/tests/extension/test_arrow.py:980:11: R1714: Consider merging these comparisons with 'in' by using 'op_name in ('__divmod__', '__rdivmod__')'. Use a set instead if elements are hashable. (consider-using-in)

@jbrockmendel
Copy link
Member Author

finally green. thanks for several steps of help

@mroeschke mroeschke added Refactor Internal refactoring of code Testing pandas testing functions or related to the test suite labels Aug 4, 2023
@mroeschke mroeschke added this to the 2.1 milestone Aug 4, 2023
@mroeschke mroeschke merged commit a3d6c36 into pandas-dev:main Aug 4, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the ref-tst-check_op branch August 4, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Internal refactoring of code Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants