Issue #283 resolved

py.test instead of nosetests?

Thomas Waldmann
created an issue

while trying to implement pep8-testing for nose (using tissue, which didn't work for me), I just tried runnin whoosh's tests with py.test: it works without a problem (as far as i could see).

py.test has some nose-compatibility: http://pytest.org/latest/nose.html

py.test has a great and time-saving pep8 plugin: http://pypi.python.org/pypi/pytest-pep8 (I have thrown away my own pep8-sourcecode-test-hack in favour of that one!)

py.test has maybe some other nice advantages (I personally don't have much experience with nose, so I am referring to some external sources):

http://fedoraproject.org/wiki/User:Tflink/AutoQA_nose_pytest_comparison

http://www.libcrack.so/2012/01/09/a-brief-analysis-of-python-testing-software/

http://mail.scipy.org/pipermail/astropy/2011-July/001673.html

We are using py.test since long for moin 1.x and moin 2. We are very happy with it as it is quite flexible, tests are easy to write and it tries to help you if a test fails (showing what exactly failed). We didn't use nose before though, we came (long long ago) from unittest (which was quite unpopular within our developers).

If you like py.test, i can help switching to it, just tell.

Comments (5)

  1. Thomas Waldmann reporter

    if you like to test py.test, put this into the toplevel setup.cfg:

    [pytest]
    addopts = --pep8 -rs
    norecursedirs = .hg .tox _build tmp* env* benchmark stress
    minversion = 2.0
    pep8ignore =
     *.py E121 E122 E123 E124 E125 E126 E127 E128  # continuation line indentation
     *.py E262  # inline comment should start with '# ' - usually a #@UnresolvedImport
     *.py E401  # imports on separate lines
     *.py E501  # maximum line length (default 79 chars)
     upload.py ALL  # 3rd party (and not in the repo): rietveld upload tool
     docs/source/conf.py ALL  # sphinx stuff, automatically generated, don't check this
     src/whoosh/lang/*.py ALL  # 3rd party / crashing py.test with non-ascii stuff
     src/whoosh/lang/snowball/*.py ALL  # 3rd party
     src/whoosh/support/relativedelta.py ALL  # 3rd party
     src/whoosh/support/charset.py ALL  # non-ascii py.test crash
     src/whoosh/support/unicode.py ALL  # non-ascii py.test crash
    
  2. Log in to comment