#1013 frontend: FTBFS rawhide
Merged 4 years ago by praiskup. Opened 4 years ago by praiskup.
Unknown source fix-testcase-rawhide  into  master

@@ -621,8 +621,8 @@

      https://stackoverflow.com/questions/19395697/sqlalchemy-session-not-getting-removed-properly-in-flask-testing

      """

      @wraps(fn)

-     def wrapper(fn, fn_self, *args):

+     def wrapper(fn, fn_self, *args, **kwargs):

          with coprs.app.app_context():

-             return fn(fn_self, *args)

+             return fn(fn_self, *args, **kwargs)

  

      return decorator.decorator(wrapper, fn)

@@ -6,7 +6,7 @@

  from copr_common.enums import ActionTypeEnum

  from coprs.logic.actions_logic import ActionsLogic

  from coprs.logic.complex_logic import ComplexLogic, ProjectForking

- from tests.coprs_test_case import CoprsTestCase

+ from tests.coprs_test_case import CoprsTestCase, new_app_context

  

  

  class TestComplexLogic(CoprsTestCase):
@@ -25,6 +25,7 @@

                  assert data["copr"] == "dstname"

                  assert data["builds_map"] == {'srpm-builds': {'bar': '00000005'},'fedora-18-x86_64': {'bar': '00000005-hello-world'}}

  

+     @new_app_context

      @mock.patch("flask.g")

      def test_fork_copr_projects_with_more_builds(self, mc_flask_g, f_users, f_fork_prepare, f_db):

          mc_flask_g.user.name = self.u2.name

Fix the test_fork_copr_projects_with_more_builds test by creating new
app context. For F32+ (something changed), per test case failure:

raise RuntimeError(_app_ctx_err_msg)
E RuntimeError: Working outside of application context.
E
E This typically means that you attempted to use functionality that needed
E to interface with the current application object in some way. To solve
E this, set up an application context with app.app_context(). See the
E documentation for more information.

To allow wrapping already wrapped method, I needed to fix the decorator
to bypass **kwargs as well.

rebased onto 017a880

4 years ago

Pull-Request has been merged by praiskup

4 years ago