Как скрыть детали ошибки утверждения на PyTest? - PullRequest
0 голосов
/ 30 октября 2019

Мне нужно скрыть подробности ошибки подтверждения для тестовых случаев неудачи, так как я делаю регистрацию в моих модулях, которые тестируются Pytest.

test_TripTick.py

import os

import pytest

from Process import RunProcess


@pytest.fixture(scope="module")
def Process(request):
    # print('\nProcess setup - module fixture')
    fileDirectory = os.path.abspath(os.path.dirname(__file__))
    configFilePath = os.path.join(fileDirectory, 'ATR220_Config.json')
    process = RunProcess.RunProcess()
    process.SetConfigVariables(configFilePath)

    # def fin():
    # print('\nProcess teardown - module fixture')

    # request.addfinalizer(fin)
    return process


def test_WipeOutReader(Process):
    assert Process.WipeOutTheReader() == True


def test_LoadingKeysIntoMemoryMap(Process):
    assert Process.LoadingKeysIntoMemoryMap() == True


def test_LoadingFW(Process):  # only use bar
    assert Process.LoadingFW() == True


def test_LoadingSBL(Process):
    assert Process.LoadingSBL() == True


def test_SmartCardReadForPaymentAndNonPayment(Process):
        assert Process.SmartCardReadWrite('Payment Card') == True


def test_GetLifeCycleOfReader(Process):
    Response = Process.GetTheLifeCycleOfTheReader('before injecting SIGN_CONF_MAIN')
    if Response:
        assert Response == '00-00-00-07'
    else:
        assert False


def test_LoadingSignConfMain(Process):
    assert Process.LoadingSignConfMain() == True

командная строка для запуска теста со студийным выходом модуля:

pytest test_TripTick.py -s

выходные результаты:

По сути, я хочу скрыть последний блок результатов вывода из окна (подробности ошибки подтверждения) OutPut

...