Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Test setup failure

from dominio import Usuario, Leilao

def test_debitar_lance(self):
    belisco = Usuario('Belisco', 100.0)

    leilao = Leilao('Celular')
    belisco.propoe_lance(leilao, 50.0)

    assert belisco.carteira == 50.0

o teste passou mas estou recebendo o seguinte aviso:

============================= test session starts ============================== platform darwin -- Python 3.8.1, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 rootdir: /Users/luisdielle/Desktop/GRINDING/PROGRAMACAO/PYTHON/Testes Automatizados collected 1 item

tests/test_usuario.py . [100%]

=============================== warnings summary =============================== /Users/luisdielle/Library/Python/3.8/lib/python/site-packages/pytest/junitxml.py:417 /Users/luisdielle/Library/Python/3.8/lib/python/site-packages/pytest/junitxml.py:417: PytestDeprecationWarning: The 'junit_family' default value will change to 'xunit2' in pytest 6.0. Add 'junit_family=xunit1' to your pytest.ini file to keep the current format in future versions of pytest and silence this warning. issuewarning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2)

-- Docs: https://docs.pytest.org/en/latest/warnings.html

  • generated xml file: /var/folders/ss/m3h5r8wn493cxmb0_yzflpfr0000gn/T/tmp-916gIOmJjR9juTv.xml - ========================= 1 passed, 1 warning in 0.01s ========================= python /Users/luisdielle/.vscode/extensions/ms-python.python-2020.4.76186/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /Users/luisdielle/Desktop/GRINDING/PROGRAMACAO/PYTHON/Testes Automatizados -s --cache-clear tests
1 resposta
solução!

Oiii Luis, tudo bem?

Executando no VSCode também pude perceber esse warning e ele está ocorrendo por causa de uma atualização nas versões internas de bibliotecas do pytest. Para corrigir isso crie uma arquivo pytest.ini na raiz do projeto e coloque:

[pytest]
junit_family=legacy

Após isso, tente executar novamente o teste :)

Abraços e bons estudos!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software