Source code for fixtures.parallelizer.parallelizer_tester

"""parallelizer tester

Useful to make sure tests are being parallelized properly, and then reported correctly.

This file is named specially to prevent being picked up by py.test's default collector, and should
not be run during a normal test run.

import random
from time import sleep

import pytest

# uncommment this to slow things down, if desired
# pytestmark= pytest.mark.usefixtures("wait")

num_copies = 20

    params=xrange(10, 10 * num_copies),
[docs]def the_param(): pass
[docs]def wait(): # Add some randomness to make sure reports are getting mixed up like they would in a "real" run sleep(random.random() * 5)
[docs]def setup_fail(): raise Exception('I failed to setup!')
[docs]def teardown_fail(): yield raise Exception('I failed to teardown!')
[docs]def test_passes(): pass
[docs]def test_fails(): raise Exception('I failed!')
[docs]def test_xfails(): raise Exception('I failed!')
[docs]def test_xpasses(): pass
[docs]def test_fails_setup(setup_fail): pass
[docs]def test_fails_teardown(teardown_fail): pass
[docs]def test_skipped(): pass