Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

Users reported inability to suppress the RuntimeWarning when using the default CasbinRule table. The warning parameter existed but was undocumented, leading to confusion.

Changes

Warning message enhancement

  • Updated RuntimeWarning text to explicitly mention suppression options (warning=False or db_class parameter)

Documentation

  • Added "Suppressing the Default Table Warning" section to README with two approaches:
    # Option 1: warning parameter
    adapter = Adapter(engine, warning=False)
    
    # Option 2: explicit db_class
    adapter = Adapter(engine, db_class=CasbinRule)

Test coverage

  • Added TestWarningParameter class with 5 tests covering:
    • Default warning behavior with updated message
    • Suppression via warning=False
    • Suppression via db_class=CasbinRule
    • Combined parameters
    • Custom db_class behavior
Original prompt

This section details on the original issue you should resolve

<issue_title>Cant suppress warning</issue_title>
<issue_description>I don't know what has happened to the version in Pypi but it's not matching the version here.

I can't seem to suppress this warning

 RuntimeWarning: Using default CasbinRule table, please note the use of the 'Adapter().create_table()' method to create the table, and ignore this warning if you are using a custom CasbinRule table.

I tried passing db_class. Still got a warning. Setting warning=False, still got a warning. Both, still got a warning.

Checked the code that was downloaded from pypi. Doesn't have the warning param. </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@nomeguy nomeguy marked this pull request as ready for review November 21, 2025 01:02
Copilot AI and others added 2 commits November 21, 2025 01:06
- Improved warning message to explicitly mention how to suppress it
- Added comprehensive test suite for warning suppression (5 new tests)
- Updated README with clear documentation on suppressing warnings
- All tests pass successfully

Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix warning message suppression for CasbinRule table Document and test warning suppression for default CasbinRule table Nov 21, 2025
Copilot AI requested a review from nomeguy November 21, 2025 01:14
@nomeguy nomeguy closed this Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cant suppress warning

2 participants