#38 Merged
pfctdayelise pfctdayelise
hpk42 hpk42

A couple of improvements to parametrize

  1. Brianna Laugher avatarBrianna Laugher

I was not sure if I should make an issue for this or not - just a couple of minor improvements. Tests included.

I guess explicitly raising an exception if the number of ids doesn't match the test cases isn't strictly necessary, but I felt that the error you get in that case is not necessarily that obvious:

tests/conftest.py:486: in pytest_generate_tests
>       __multicall__.execute()
/work/gfe-devel-2.0.0/lib/python2.7/site-packages/pytest-2.2.3-py2.7.egg/_pytest/core.py:348: in execute
>           res = method(**kwargs)
/work/gfe-devel-2.0.0/lib/python2.7/site-packages/pytest-2.2.3-py2.7.egg/_pytest/python.py:37: in pytest_generate_tests
>           metafunc.parametrize(*p.args, **p.kwargs)
/work/gfe-devel-2.0.0/lib/python2.7/site-packages/pytest-2.2.3-py2.7.egg/_pytest/python.py:646: in parametrize
>               newcallspec.setmulti(valtype, argnames, valset, ids[i])
E               IndexError: list index out of range

Comments (9)

    1. Brianna Laugher author

      Do I need to install a different version of py.test or anything for it to run on python 2.5? I installed python2.5 using 'make altinstall', I have my dev py.test in a virtualenv and I can't figure out how to get them to play together.

      (pytest)blaugher@gfedev22 /work/blaugher/workspace/pytest]$python2.5 -m py.test testing/ -q
      Traceback (most recent call last):
        File "/usr/local/lib/python2.5/runpy.py", line 85, in run_module
          loader = get_loader(mod_name)
        File "/usr/local/lib/python2.5/pkgutil.py", line 456, in get_loader
          return find_loader(fullname)
        File "/usr/local/lib/python2.5/pkgutil.py", line 466, in find_loader
          for importer in iter_importers(fullname):
        File "/usr/local/lib/python2.5/pkgutil.py", line 422, in iter_importers
      ImportError: No module named py

      I tried deactivating the virtualenv and cding into its bin dir and running it like this, but the same error:

      ~/.virtualenvs/pytest/bin]$python2.5 -m py.test /work/blaugher/workspace/pytest/testing/ -q

      Do I need to make a new virtualenv explicitly with python2.5 and check out my dev branch of pytest again, is that likely to work?

      1. holger krekel repo owner

        yes, you need create a fresh virtualenv with that python2.5 interpreter. And then "python setup.py develop" from your branch to run tests inline.

        Alternatively, you can install tox and issue "tox -e py25" from your branch. This will create the virtualenv (under .tox/py25) for you, package your branch and then run tests against it.

  1. holger krekel repo owner

    i've used pythonbrew in the past, and recently there was another project which might be simpler - but i forgot the name and can't find it at the moment :/

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.