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

1k views Asked by At

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))
1

There are 1 answers

0
IslamTaha On BEST ANSWER

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))