Add test case name in test logs (#6431)

Signed-off-by: Binbin Lv <binbin.lv@zilliz.com>
pull/6431/merge
binbin 2021-07-12 13:11:53 +08:00 committed by GitHub
parent a8e5fd2024
commit 594b89067f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -50,8 +50,9 @@ class Base:
log.info("[teardown_class] Start teardown class...")
pass
def setup(self):
def setup_method(self, method):
log.info(("*" * 35) + " setup " + ("*" * 35))
log.info("[setup_method] Start setup test case %s..." % method.__name__)
self.connection_wrap = ApiConnectionsWrapper()
self.utility_wrap = ApiUtilityWrapper()
self.collection_wrap = ApiCollectionWrapper()
@ -60,8 +61,9 @@ class Base:
self.collection_schema_wrap = ApiCollectionSchemaWrapper()
self.field_schema_wrap = ApiFieldSchemaWrapper()
def teardown(self):
def teardown_method(self, method):
log.info(("*" * 35) + " teardown " + ("*" * 35))
log.info("[teardown_method] Start teardown test case %s..." % method.__name__)
try:
""" Drop collection before disconnect """

View File

@ -15,7 +15,8 @@ class TestLog:
self.log.setLevel(logging.DEBUG)
try:
formatter = logging.Formatter("[%(asctime)s - %(levelname)s - %(name)s]: %(message)s (%(filename)s:%(lineno)s)")
formatter = logging.Formatter("[%(asctime)s - %(levelname)s - %(name)s]: "
"%(message)s (%(filename)s:%(lineno)s)")
dh = logging.FileHandler(self.log_debug)
dh.setLevel(logging.DEBUG)
dh.setFormatter(formatter)