Browse Source

Fix pytest deprecation warnings

Peter Justin 4 years ago
parent
commit
77bd65630d
3 changed files with 5 additions and 5 deletions
  1. 1 1
      setup.cfg
  2. 3 3
      tests/fixtures/app.py
  3. 1 1
      tests/unit/test_requirements.py

+ 1 - 1
setup.cfg

@@ -7,7 +7,7 @@ license_file = LICENSE
 [tool:pytest]
 [tool:pytest]
 addopts =
 addopts =
     -vvl
     -vvl
-    --strict
+    --strict-markers
     --capture fd
     --capture fd
     --tb short
     --tb short
     --pythonwarnings error::flaskbb.deprecation.FlaskBBDeprecation
     --pythonwarnings error::flaskbb.deprecation.FlaskBBDeprecation

+ 3 - 3
tests/fixtures/app.py

@@ -6,7 +6,7 @@ from flaskbb.extensions import db
 from flaskbb.utils.populate import create_default_groups, create_default_settings
 from flaskbb.utils.populate import create_default_groups, create_default_settings
 
 
 
 
-@pytest.yield_fixture(autouse=True)
+@pytest.fixture(autouse=True)
 def application():
 def application():
     """application with context."""
     """application with context."""
     app = create_app(Config)
     app = create_app(Config)
@@ -19,7 +19,7 @@ def application():
     ctx.pop()
     ctx.pop()
 
 
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def request_context(application):
 def request_context(application):
     with application.test_request_context():
     with application.test_request_context():
         yield
         yield
@@ -43,7 +43,7 @@ def default_settings(database):
     return create_default_settings()
     return create_default_settings()
 
 
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def database():
 def database():
     """database setup."""
     """database setup."""
     db.create_all()  # Maybe use migration instead?
     db.create_all()  # Maybe use migration instead?

+ 1 - 1
tests/unit/test_requirements.py

@@ -9,7 +9,7 @@ def push_onto_request_context(**kw):
         setattr(_request_ctx_stack.top, name, value)
         setattr(_request_ctx_stack.top, name, value)
 
 
 
 
-@pytest.yield_fixture
+@pytest.fixture
 def request_context(application):
 def request_context(application):
     with application.test_request_context():
     with application.test_request_context():
         yield
         yield