So I have a directory with sub-directory of Acceptance Tests. Most of my tests have no dependancies on each other, expect for one suite. Is there a way I can tell nose when it reaches this class to execute the tests sequentially. Then once it hits the next class to enable multi-processing again? This is nothing to do with fixtures in this test suite they simply can't run concurrently. They are executing APIs which affect other tests running at the same time.
Thanks in advance.
I would use nose attribute plugin to decorate tests that require disabling multiprocessing explicitly and run two nose commands: one with multiprocessing enabled, excluding sensitive tests, and one with multiprocessing disabled, including only sensitive tests. You would have to rely on CI framework should combine test results. Something like:
from unittest import TestCase
from nose.plugins.attrib import attr
@attr('sequential')
class MySequentialTestCase(TestCase):
def test_in_seq_1(self):
pass
def test_in_seq_2(self):
pass
class MyMultiprocessingTestCase(TestCase):
def test_in_parallel_1(self):
pass
def test_in_parallel_2(self):
pass
And run it like:
> nosetests -a '!sequential' --processes=10
test_in_parallel_1 (ms_test.MyMultiprocessingTestCase) ... ok
test_in_parallel_2 (ms_test.MyMultiprocessingTestCase) ... ok
----------------------------------------------------------------------
Ran 2 tests in 0.071s
OK
> nosetests -a sequential
test_in_seq_1 (ms_test.MySequentialTestCase) ... ok
test_in_seq_2 (ms_test.MySequentialTestCase) ... ok
----------------------------------------------------------------------
Ran 2 tests in 0.000s
OK