0

我的简单项目中有以下文件:

test_A.py

def test_A( rp_logger): 
    rp_logger.info("this is test A")

test_B.py

def test_B(rp_logger): 
    rp_logger.info("this is test B")

conftest.py

import logging
import pytest

@pytest.fixture(scope="session")
def rp_logger(request): 
    logger = logging.getLogger(__name__) 
    logger.setLevel(logging.DEBUG) 
    rp_handler = logging.StreamHandler(sys.stdout) 
    rp_handler.setLevel(logging.INFO) 
    return logger

pytest.ini带有报告门户参数的文件:rp_endpointrp_uuid

令人惊讶的是,在报告门户中,我看到测试 B 的结果嵌套在测试 A 的结果中:

All > test #1 > tests/test_A.py > tests/test_B.py > test_B 

你能建议如何解决这个问题吗?

4

0 回答 0