From fc226ed5f6d87f22ac63e4f156d733bd55b3272d Mon Sep 17 00:00:00 2001 From: Kfir Hadas Date: Thu, 3 Aug 2017 00:39:43 +0300 Subject: [PATCH] Update request_context --- tests/__init__.py | 6 +++--- tests/test_template_utils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index f744a31..6c4aebc 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,6 +1,6 @@ """ Sets up helper class for testing """ -import os +import os.path as op import unittest from nyaa import create_app @@ -20,7 +20,7 @@ class NyaaTestCase(unittest.TestCase): # cls.db_name = 'nyaav2_tests' # db_uri = 'mysql://root:@localhost/{}?charset=utf8mb4'.format(cls.db_name) # else: - # cls.db_name = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'test.db') + # cls.db_name = op.abspath(op.join(op.dirname(__file__)), 'test.db') # db_uri = 'sqlite:///{}?check_same_thread=False'.format(cls.db_name) # if not os.environ.get('TRAVIS'): # Travis doesn't need a seperate DB @@ -29,7 +29,7 @@ class NyaaTestCase(unittest.TestCase): cls.app = app cls.app_context = app.app_context() - cls.request_context = app.test_request_context() + cls.request_context = app.test_request_context with cls.app_context: cls.client = app.test_client() diff --git a/tests/test_template_utils.py b/tests/test_template_utils.py index 9f92bac..08fe4ed 100644 --- a/tests/test_template_utils.py +++ b/tests/test_template_utils.py @@ -17,7 +17,7 @@ class TestTemplateUtils(NyaaTestCase): pass def test_static_cachebuster(self): - with self.request_context: + with self.request_context(): # Save this value in order to restore it in the end. orig_debug = self.app.debug