To better depict what I am saying follows some code.

$ sudo pip install pytest
$ sudo pip install pytest-xdist
$ py.test -vs test_dummy.py -n 2


#!/usr/bin/env python

"""
This is test_dummy.py
"""
import pytest
import time

@pytest.fixture(scope="function", params=["a1", "a2"])
def fix_dummy(request):
    print "fix_dummy: parameter: %s" % (request.param, )
    return request.param

def test_dummy1(fix_dummy):
    print "parameter from fix_dummy: %s" %(fix_dummy, )
    time.sleep(2)


Cheers,
Gonçalo



On Sat, Dec 6, 2014 at 6:45 PM, Goncalo Morgado <goncalo.ma...@gmail.com>
wrote:

>
> pytest-xdist helped me to run different tests in multiple CPUs, for
> instance test_foo() and test_bar() would easily be run in two CPUs with
> pytest-xdist. The problem is when you have test_foobar(some_fixture), where
> some_fixture is parametrized with, let's say two parameters ["a", "b"],
> which will lead to two different test runs of test_foobar(). The challenge
> is to have these two test runs running in two CPUs.
>
> Cheers
> Gonçalo
>
>
> On Sat, Dec 6, 2014 at 6:30 PM, Bruno Oliveira <nicodde...@gmail.com>
> wrote:
>
>> Have you tried using pytest-xdist?
>>
>> Cheers,
>>
>> On Sat, Dec 6, 2014 at 4:26 PM, Goncalo Morgado <goncalo.ma...@gmail.com>
>> wrote:
>>
>>>
>>> Hi pytest community,
>>>
>>> I am not sure this is the right place to ask this, and I am sorry if
>>> it's not.
>>> I am trying to make use of multiple CPUs to run my tests, which I can
>>> for separately defined tests (different test_ functions for instance). *The
>>> challenge is to run tests, generated from one single test_ function which
>>> fixture it depends on is parametrized with multiple parameters, on multiple
>>> CPUs*.
>>> Currently I have this test that generates more than a thousand tests
>>> (because of the parametrized fixture it depends on) and ends up being very
>>> time consuming to run in one single CPU.
>>>
>>> Thanks for this great tool that is pytest!
>>>
>>> Cheers,
>>> Gonçalo
>>>
>>>
>>>
>>> _______________________________________________
>>> pytest-dev mailing list
>>> pytest-dev@python.org
>>> https://mail.python.org/mailman/listinfo/pytest-dev
>>>
>>>
>>
>
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to