0

I read How do I skip a whole Python unittest module at run-time? and this doesn't seems like a very neat way

In Java all you have to say is @Ignore on test class and the entire test class is ignored

Is there a better way to skip the entire test module or shall i just do

class TestMe():
  @unittest.skip
  def test_a(self):
    pass

  @unittest.skip
  def test_b(self):
    pass
  ...

by adding @unittest.skip on all the test on module

Community
  • 1
  • 1
daydreamer
  • 87,243
  • 191
  • 450
  • 722

2 Answers2

7

Just use the decorator on the class, as per the docs:

@unittest.skip("showing class skipping")
class MySkippedTestCase(unittest.TestCase):
    def test_not_run(self):
        pass
Gareth Latty
  • 86,389
  • 17
  • 178
  • 183
3

As per comment, the following works

@unittest.skip
class TestMe():
  def test_a(self):
    pass

  def test_b(self):
    pass
  ...

by adding the annotation @unittest.skip on the class instead of each method

daydreamer
  • 87,243
  • 191
  • 450
  • 722