forked from 3wordchant/capsul-flask
trying to do CaptureLogOutputDuringTestsFilter (but no worky yet)
This commit is contained in:
@ -22,17 +22,10 @@ class BaseTestCase(TestCase):
|
||||
return self.app
|
||||
|
||||
def setUp(self):
|
||||
self.logs_from_test = StringIO()
|
||||
self.logs_handler = logging.StreamHandler(self.logs_from_test)
|
||||
current_app.logger.addHandler(self.logs_handler)
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
#self.app.logger.removeHandler(self.logs_handler)
|
||||
#logging.getLogger("asdasd1").warning(f"{self.id()} captured output:\n{self.logs_from_test.getvalue()}\n")
|
||||
|
||||
file_object = open('unittest-output.log', 'a')
|
||||
file_object.write(f"{self.id()} captured output:\n{self.logs_from_test.getvalue()}\n")
|
||||
file_object.close()
|
||||
pass
|
||||
|
||||
def _login(self, user_email):
|
||||
get_model().login(user_email)
|
||||
|
Reference in New Issue
Block a user