Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description:
Currently in PTL we don't have any decorator which will skip the testcase irrespective of any condition. We need such decorator, so that without adding any skip code inside the testcase, we can skip the testcase in any condition just by applying it.

...

Forum: http://community.pbspro.org/t/pp-1278-need-a-skip-decorator-in-ptl-which-will-skip-the-test-without-any-condition/1000


Interface: @skip(reason)
Visibility: Public
Change Control: Stable
Synopsis: New interface to skip the testcase without any skip condition.
Details: This interface will provide user a way to skip a particular testcase with the reason and irrespective of any skip condition.

  • This interface takes one parameter called 'reason'.
  • If '@skip' is applied over a testcase then:
    • Call 'skip()' function defined inside 'utils/pbs_testsuite.py'.
    • Define a wrapper inside 'skip()' which will call 'skipTestskipTest()' by passing the 'reason' as an argument to it. 
    • Return the wrapper function.
    • Raise a 'SkipTest' Exception inside 'skipTest()' function with the reason passed and skip the testcase setUp() and execution.
  • Example:

Skip test test_t1:

@skip("Skipping this test due to <issue_id>")
def test_t1:

.

.

Skip the complete testsuite:

@skip("Skipping this testsuite due to <issue_id>")

class SmokeTest():

.

.