flask-restx icon indicating copy to clipboard operation
flask-restx copied to clipboard

LoggingTest.test_override_app_level fail

Open mcepl opened this issue 2 years ago • 0 comments

When running the test suite while packaging flask-restx for openSUSE, I’ve got this failed test:

[   24s] =================================== FAILURES ===================================
[   24s] _____________________ LoggingTest.test_override_app_level ______________________
[   24s]
[   24s] self = <tests.test_logging.LoggingTest object at 0x7fd303f5d640>
[   24s] app = <Flask 'tests.conftest'>, client = <TestClient <Flask 'tests.conftest'>>
[   24s] caplog = <_pytest.logging.LogCaptureFixture object at 0x7fd303ebb370>
[   24s]
[   24s]     def test_override_app_level(self, app, client, caplog):
[   24s]         caplog.set_level(logging.INFO, logger=app.logger.name)
[   24s]
[   24s]         api = restx.Api(app)
[   24s]         ns1 = api.namespace("ns1", path="/ns1")
[   24s]         ns1.logger.setLevel(logging.DEBUG)
[   24s]         ns2 = api.namespace("ns2", path="/ns2")
[   24s]
[   24s]         @ns1.route("/")
[   24s]         class Ns1(restx.Resource):
[   24s]             def get(self):
[   24s]                 ns1.logger.debug("hello from ns1")
[   24s]                 pass
[   24s]
[   24s]         @ns2.route("/")
[   24s]         class Ns2(restx.Resource):
[   24s]             def get(self):
[   24s]                 ns2.logger.debug("hello from ns2")
[   24s]                 pass
[   24s]
[   24s]         # debug log shown from ns1
[   24s]         client.get("/ns1/")
[   24s]         matching = [r for r in caplog.records if r.message == "hello from ns1"]
[   24s] >       assert len(matching) == 1
[   24s] E       assert 0 == 1
[   24s] E         +0
[   24s] E         -1
[   24s]
[   24s] tests/test_logging.py:89: AssertionError
[   24s] ------------------------------ Captured log call -------------------------------
[   24s] DEBUG    flask_restx.namespace.ns1:test_logging.py:77 hello from ns1
[   24s] =============================== warnings summary ===============================
[   24s] tests/test_namespace.py:178
[   24s]   /home/abuild/rpmbuild/BUILD/flask-restx-0.5.1/tests/test_namespace.py:178: DeprecationWarning: invalid escape sequence \(
[   24s]     assert re.match("Additional properties are not allowed \(u*'agge' was unexpected\)", resp["errors"][""])
[   24s]
[   24s] <unknown>:178
[   24s]   <unknown>:178: DeprecationWarning: invalid escape sequence \(
[   24s]
[   24s] -- Docs: https://docs.pytest.org/en/stable/warnings.html
[   24s]

Environment

  • Python version
[   13s] ============================= test session starts ==============================
[   13s] platform linux -- Python 3.9.10, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /usr/bin/python3.9
[   13s] cachedir: .pytest_cache
[   13s] benchmark: 3.2.3 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
[   13s] rootdir: /home/abuild/rpmbuild/BUILD/flask-restx-0.5.1, configfile: setup.cfg, testpaths: tests
[   13s] plugins: benchmark-3.2.3, flask-1.0.0, mock-3.6.1, Faker-10.0.0
[   15s] collecting ... collected 1229 items / 205 deselected / 1024 selected
  • Flask-RESTX version 0.5.1
  • Other installed Flask extensions none

Additional Context

Complete build log with all details of packages used and steps taken to reproduce.

mcepl avatar Feb 10 '22 18:02 mcepl