Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to pytest for test running #240

Merged
merged 9 commits into from
Apr 9, 2020
Merged

Switch to pytest for test running #240

merged 9 commits into from
Apr 9, 2020

Conversation

jstasiak
Copy link
Collaborator

@jstasiak jstasiak commented Apr 9, 2020

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

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
Copy link

coveralls commented Apr 9, 2020

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.

None yet

2 participants