[py-svn] [hpk42/pytest] Add an easy way for plugins to format objects for idmaker (issue #238)

Gustavo Picon issues-reply at bitbucket.org
Thu Dec 13 03:03:31 CET 2012


--- you can reply above this line ---

New issue 238: Add an easy way for plugins to format objects for idmaker
https://bitbucket.org/hpk42/pytest/issue/238/add-an-easy-way-for-plugins-to-format

Gustavo Picon:

One of the things I missed when I ported a hacky dynamic unittest suite to pytest fixtures, was the information I got from the test names. I parametrize 6 different django models in every test, but in the report I saw something like:

    test_add_sibling_first[model0]
    test_add_sibling_first[model1]
    test_add_sibling_first[model2]
    ...

Which wasn't helpful at all. I solved this problem by [monkeypatching _pytest.python.idmaker](https://bitbucket.org/tabo/django-treebeard/src/fd57de9692913126a31c87c909a45f84a919fffe/treebeard/tests/conftest.py?at=default#cl-20). Now I have [nicer results](https://tabo.pe/jenkins/job/django-treebeard/34/TOX_DB=sqlite,TOX_DJANGO=dj15,TOX_PYTHON=py32,os=windows/testReport/treebeard.tests.test_treebeard/TestAddSibling/), like:

    test_add_sibling_first[AL_TestNode]
    test_add_sibling_first[AL_TestNodeProxy]
    test_add_sibling_first[MP_TestNode]
    ...

It would be better if pytest provided an interface for plugins to handle different object types, so for instance pytest_django could register itself as being in charge of formatting all django orm objects and views.

Responsible: hpk42
--

This is an issue notification from bitbucket.org. You are receiving
this either because you are the owner of the issue, or you are
following the issue.



More information about the pytest-commit mailing list