IslamTaha
IslamTaha

Reputation: 1594

skip only one parameter from the parameterized list in python nose-parameterized

As I understand, parameterized.expand([1, 2, 3]) will create three test cases. I would like to know how can I skip only one of them?

I know that @unitest.skip() will skip the whole 3 test cases, I only wanna to skip one of them.

Here is a simple code

from nose_parameterized import parameterized
import unittest

class Read(unittest.TestCase):
    @parameterized.expand(['1', '2', '3', '4'])
    def test000_test1(self, operation):
        print operation
        self.assertGreater(5, int(operation))

Upvotes: 3

Views: 1150

Answers (1)

IslamTaha
IslamTaha

Reputation: 1594

I did this trick while some one may be find another pro method.

from nose_parameterized import parameterized
import unittest


class Read(unittest.TestCase):
    @parameterized.expand(['1', '2', '3', '4'])
    def test000_test1(self, operation):
        if operation == '2':
            self.skipTest('REASON')
    self.assertGreater(5, int(operation))

Upvotes: 2

Related Questions