Skip to content

Switch to pytest for test running#240

Merged
jstasiak merged 9 commits into
masterfrom
switch-to-pytest
Apr 9, 2020
Merged

Switch to pytest for test running#240
jstasiak merged 9 commits into
masterfrom
switch-to-pytest

Conversation

@jstasiak

@jstasiak jstasiak commented Apr 9, 2020

Copy link
Copy Markdown
Collaborator

Nose is dead for all intents and purposes (last release in 2015) and
pytest provide a very valuable feature of printing relevant extra
information in case of assertion failure (from[1]):

================================= FAILURES =================================
_______________________________ test_answer ________________________________

    def test_answer():
>       assert func(3) == 5
E       assert 4 == 5
E        +  where 4 = func(3)

test_sample.py:6: AssertionError
========================= short test summary info ==========================
FAILED test_sample.py::test_answer - assert 4 == 5
============================ 1 failed in 0.12s =============================

This should be helpful in debugging tests intermittently failing on
PyPy.

Several TestCase.assertEqual() calls have been replaced by plain
assertions now that that method no longer provides anything we can't get
without it. Few assertions have been modified to not explicitly provide
extra information in case of failure – pytest will provide this
automatically.

[1] https://docs.pytest.org/en/latest/getting-started.html#create-your-first-test

jstasiak added 2 commits April 9, 2020 12:06
Nose is dead for all intents and purposes (last release in 2015) and
pytest provide a very valuable feature of printing relevant extra
information in case of assertion failure (from[1]):

    ================================= FAILURES =================================
    _______________________________ test_answer ________________________________

        def test_answer():
    >       assert func(3) == 5
    E       assert 4 == 5
    E        +  where 4 = func(3)

    test_sample.py:6: AssertionError
    ========================= short test summary info ==========================
    FAILED test_sample.py::test_answer - assert 4 == 5
    ============================ 1 failed in 0.12s =============================

This should be helpful in debugging tests intermittently failing on
PyPy.

Several TestCase.assertEqual() calls have been replaced by plain
assertions now that that method no longer provides anything we can't get
without it. Few assertions have been modified to not explicitly provide
extra information in case of failure – pytest will provide this
automatically.

[1] https://docs.pytest.org/en/latest/getting-started.html#create-your-first-test
@coveralls

coveralls commented Apr 9, 2020

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.003%) to 93.725% when pulling 17d74aa on switch-to-pytest into 0cbced8 on master.

@jstasiak jstasiak merged commit f071f3d into master Apr 9, 2020
@jstasiak jstasiak deleted the switch-to-pytest branch April 10, 2020 07:25
mattsaxon added a commit to mattsaxon/python-zeroconf that referenced this pull request Apr 10, 2020
Switch to pytest for test running (python-zeroconf#240)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants