if not gevent.monkey.is_module_patched("threading"): # pragma: no cover
raise RuntimeError(
"gevent observers require the 'threading' module to be "
"monkeypatched by gevent."
)
I have a small unittest:
import unittest
from app import create_app, db
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
self.client = self.app.test_client(use_cookies=True)
db.create_all()
def tearDown(self):
db.session.close()
db.drop_all()
self.app_context.pop()
class AppBasicsTestCase(BaseTestCase):
def test_app_is_exists(self):
self.assertFalse(current_app is None)
def test_app_is_testing_environment(self):
self.assertTrue(current_app.config['TESTING'])
def test_cli_is_working(self):
runner = current_app.test_cli_runner()
result = runner.invoke(args=['test'])
self.assertEqual(result.exit_code, 0)
result = runner.invoke(args=['test', '--coverage'])
self.assertEqual(result.exit_code, 0)
When I run the test, I get a warning:
00:48 $ make test-show-warnings
================================================= test session starts ==================================================
platform linux -- Python 3.10.4, pytest-7.1.3, pluggy-1.0.0 -- /home/wakko/Documents/Projects/rpa-console/.venv/bin/python3
cachedir: .pytest_cache
rootdir: /home/wakko/Documents/Projects/rpa-console/tests
plugins: cov-3.0.0
collected 3 items
tests/test_app_basics.py::AppBasicsTestCase::test_app_is_exists PASSED [ 33%]
tests/test_app_basics.py::AppBasicsTestCase::test_app_is_testing_environment PASSED [ 66%]
tests/test_app_basics.py::AppBasicsTestCase::test_cli_is_working PASSED [100%]
=================================================== warnings summary ===================================================
.venv/lib/python3.10/site-packages/dramatiq/watcher.py:9
/home/wakko/Documents/Projects/rpa-console/.venv/lib/python3.10/site-packages/dramatiq/watcher.py:9: ImportWarning: gevent observers require the 'threading' module to be monkeypatched by gevent.
import watchdog_gevent
test_app_basics.py::AppBasicsTestCase::test_app_is_testing_environment
test_app_basics.py::AppBasicsTestCase::test_cli_is_working
/home/wakko/Documents/Projects/rpa-console/.venv/lib/python3.10/site-packages/flask_security/core.py:1364: DeprecationWarning: Replacing login_manager is deprecated in 5.0.0 and will be removed in 5.1
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================ 3 passed, 3 warnings in 1.02s =============================================
Hi!
I have a question about this checking:
I have a small unittest:
When I run the test, I get a warning:
How I can suppress this warning?