PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, April 27, 2022

[FIXED] How to ignore SAWarning in pytest

 April 27, 2022     pytest, sqlalchemy, warnings     No comments   

Issue

I get this warning:

/app/facelo/extensions.py:36: SAWarning: DELETE statement on table 'trials' expected to delete 1 row(s); 0 were matched. Please set confirm_deleted_rows=False within the mapper configuration to prevent this warning.

I want to ignore it. I tried to use:

@pytest.mark.filterwarnings("ignore::SAWarning")

It gives me:

INTERNALERROR> warnings._OptionError: unknown warning category: 'SAWarning'

So it doesn't work because pytest doesn't know this warning. How can Ignore this warning?


Solution

In this question, can pytest ignore a specific warning? , they supply the full path to the exception. They are using a configuration file but try that with the SAWarning using mark.

@pytest.mark.filterwarnings("ignore::sqlalchemy.exc.SAWarning")


Answered By - Ian Wilson
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing