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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

tox.ini: Switch to use py.test #527

Merged
merged 2 commits into from Feb 6, 2015

Conversation

3 participants
@msabramo
Contributor

msabramo commented Dec 1, 2014

because it's awesome.

This might be more controversial, since test runners can be a bit of a religion... 馃槃

py.test can take a bunch of different arguments so I added {posargs} to the tox.ini so that options can be passed from a tox command to the underlying py.test. For example:

$ tox -e py27,py34 -- --tb=short --showlocals --durations=5 supervisor/tests/test_supervisorctl.py
GLOB sdist-make: /Users/marca/dev/git-repos/supervisor/setup.py
py27 inst-nodeps: /Users/marca/dev/git-repos/supervisor/.tox/dist/supervisor-4.0.0-dev.zip
py27 runtests: PYTHONHASHSEED='2805401122'
py27 runtests: commands[0] | py.test --tb=short --showlocals --durations=5 supervisor/tests/test_supervisorctl.py
============================================================================= test session starts ==============================================================================
platform darwin -- Python 2.7.6 -- py-1.4.26 -- pytest-2.6.4
collected 193 items

supervisor/tests/test_supervisorctl.py .................................................................................................................................................................................................

=========================================================================== slowest 5 test durations ===========================================================================
0.00s call     supervisor/tests/test_supervisorctl.py::fgthread_Tests::test_ctor
0.00s call     supervisor/tests/test_supervisorctl.py::test_suite
0.00s call     supervisor/tests/test_supervisorctl.py::TestDefaultControllerPlugin::test_maintail_dashf
0.00s setup    supervisor/tests/test_supervisorctl.py::ControllerTests::test__upcheck_reraises_other_xmlrpc_faults
0.00s call     supervisor/tests/test_supervisorctl.py::ControllerTests::test__upcheck
========================================================================== 193 passed in 0.31 seconds ==========================================================================
py34 inst-nodeps: /Users/marca/dev/git-repos/supervisor/.tox/dist/supervisor-4.0.0-dev.zip
py34 runtests: PYTHONHASHSEED='2805401122'
py34 runtests: commands[0] | py.test --tb=short --showlocals --durations=5 supervisor/tests/test_supervisorctl.py
============================================================================= test session starts ==============================================================================
platform darwin -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
collected 193 items

supervisor/tests/test_supervisorctl.py .................................................................................................................................................................................................

=========================================================================== slowest 5 test durations ===========================================================================
0.01s call     supervisor/tests/test_supervisorctl.py::TestDefaultControllerPlugin::test_maintail_dashf
0.00s call     supervisor/tests/test_supervisorctl.py::fgthread_Tests::test_ctor
0.00s call     supervisor/tests/test_supervisorctl.py::test_suite
0.00s call     supervisor/tests/test_supervisorctl.py::ControllerTests::test__upcheck
0.00s call     supervisor/tests/test_supervisorctl.py::TestDefaultControllerPlugin::test_tail_failed
========================================================================== 193 passed in 0.37 seconds ==========================================================================
___________________________________________________________________________________ summary ____________________________________________________________________________________
  py27: commands succeeded
  py34: commands succeeded
  congratulations :)

or

$ .tox/py27/bin/py.test -k test_no_config_file_exits -v
============================================================================= test session starts ==============================================================================
platform darwin -- Python 2.7.6 -- py-1.4.26 -- pytest-2.6.4 -- /Users/marca/dev/git-repos/supervisor/.tox/py27/bin/python2.7
collected 1141 items

supervisor/tests/test_options.py::ServerOptionsTests::test_no_config_file_exits PASSED

============================================================ 1140 tests deselected by '-ktest_no_config_file_exits' ============================================================
============================================================ 1 passed, 1140 deselected, 1 warnings in 0.74 seconds =============================================================

I often find it very useful in particular to run just a single test or a small subset of the tests. The supervisor test suite is pretty darned fast at this point so it's not a huge deal but maybe it could be later if we added more extensive integration tests.

pytest's fixture mechanism (dependency injection) is pretty awesome too and can lead to powerful and succint tests.

@msabramo

This comment has been minimized.

Show comment
Hide comment
@msabramo

msabramo Dec 2, 2014

Contributor

Cc: @mcdonc since he may want to weigh in on the test runner.

Contributor

msabramo commented Dec 2, 2014

Cc: @mcdonc since he may want to weigh in on the test runner.

@mnaberez

This comment has been minimized.

Show comment
Hide comment
@mnaberez

mnaberez Dec 2, 2014

Member

I often find it very useful in particular to run just a single test or a small subset of the tests. The supervisor test suite is pretty darned fast at this point so it's not a huge deal but maybe it could be later if we added more extensive integration tests.

I would prefer to defer solutions for a slow test suite to a time when we have that issue.

pytest's fixture mechanism (dependency injection) is pretty awesome too and can lead to powerful and succint tests.

I'm not keen on adding more dependencies to Supervisor. I think it could be alright as an optional dependency (like how we use tox). I wouldn't want to use features of it that would make it required unless it solved some issue that was painful without it. I don't see that currently.

I guess overall I'm 0 or -1 on this change. @mcdonc what do you think?

Member

mnaberez commented Dec 2, 2014

I often find it very useful in particular to run just a single test or a small subset of the tests. The supervisor test suite is pretty darned fast at this point so it's not a huge deal but maybe it could be later if we added more extensive integration tests.

I would prefer to defer solutions for a slow test suite to a time when we have that issue.

pytest's fixture mechanism (dependency injection) is pretty awesome too and can lead to powerful and succint tests.

I'm not keen on adding more dependencies to Supervisor. I think it could be alright as an optional dependency (like how we use tox). I wouldn't want to use features of it that would make it required unless it solved some issue that was painful without it. I don't see that currently.

I guess overall I'm 0 or -1 on this change. @mcdonc what do you think?

@mcdonc

This comment has been minimized.

Show comment
Hide comment
@mcdonc

mcdonc Dec 12, 2014

Member

It would replace nose in tests_require so I don't think it's an extra dependency.I'm a huge fan of Holger Krekel's, so I'm not actively against a merge.

That said, it's one of those things that is kinda meh. I'm 0 on it as well. nose-selecttests can be used to do same if running a subset is the main driving use case.

I think if both me and Mike come down as 0 on it and Marc wants it, we should merge it if it means Marc thinks he can contribute more easily, cuz Marc has done a boatload in supervisor so far.

Member

mcdonc commented Dec 12, 2014

It would replace nose in tests_require so I don't think it's an extra dependency.I'm a huge fan of Holger Krekel's, so I'm not actively against a merge.

That said, it's one of those things that is kinda meh. I'm 0 on it as well. nose-selecttests can be used to do same if running a subset is the main driving use case.

I think if both me and Mike come down as 0 on it and Marc wants it, we should merge it if it means Marc thinks he can contribute more easily, cuz Marc has done a boatload in supervisor so far.

@mnaberez

This comment has been minimized.

Show comment
Hide comment
@mnaberez

mnaberez Dec 12, 2014

Member

I'm 0 on it then but testing_extras in setup.py needs to be updated.

Member

mnaberez commented Dec 12, 2014

I'm 0 on it then but testing_extras in setup.py needs to be updated.

msabramo added some commits Dec 1, 2014

tox.ini: Switch to use py.test
because it's awesome.
setup.py: testing_extras: nose => pytest
Plus make setup.py pep8-compliant.
@msabramo

This comment has been minimized.

Show comment
Hide comment
@msabramo

msabramo Jan 26, 2015

Contributor

OK, just updated testing_extras.

@sontek: @mcdonc and @mnaberez are +0 so if you are +1 I think we win the test framework game.

Contributor

msabramo commented Jan 26, 2015

OK, just updated testing_extras.

@sontek: @mcdonc and @mnaberez are +0 so if you are +1 I think we win the test framework game.

mnaberez added a commit that referenced this pull request Feb 6, 2015

Merge pull request #527 from msabramo/pytest
tox.ini: Switch to use py.test

@mnaberez mnaberez merged commit eb8396d into Supervisor:master Feb 6, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@msabramo msabramo deleted the msabramo:pytest branch Feb 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment