Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip Decorators: fix issues when setUp or the test function would/would not be run #4528

Commits on Apr 13, 2021

  1. Skip decorators: require condition parameter

    Signed-off-by: Cleber Rosa <crosa@redhat.com>
    clebergnu committed Apr 13, 2021
    Configuration menu
    Copy the full SHA
    086307e View commit details
    Browse the repository at this point in the history
  2. Skip Decorators: fix a bug when no condition for skip exists

    When no condition for skip exists, the test should *not* be skipped,
    that is, it should run.  But, the current decorator was not executing
    the decorated function.
    
    This was being masqueraded because the default behavior for tests that
    do nothing is to pass, and by not running the decorated function (the
    test) it would effectively pass.  Now the tests make sure that the
    test method gets executed (and does a cancel when running it).
    
    Signed-off-by: Cleber Rosa <crosa@redhat.com>
    clebergnu committed Apr 13, 2021
    Configuration menu
    Copy the full SHA
    c607ecc View commit details
    Browse the repository at this point in the history
  3. Skip Decorators: forward information about required condition

    This adds a new parameter, which signals how the result of the
    condition should be evaluated, that is, if it should be negated.
    
    This makes all the logic available to the decorator, and will be
    required later.
    
    Signed-off-by: Cleber Rosa <crosa@redhat.com>
    clebergnu committed Apr 13, 2021
    Configuration menu
    Copy the full SHA
    452e0ed View commit details
    Browse the repository at this point in the history
  4. Skip decorator: apply skip dynamic conditions to setUp()

    There's currently a bug in cause by the fact that the decorator
    function is always marked (__skip_method_decorator__) to be skipped,
    even when the condition is supposed to be evaluated later, during
    the execution of the decorator.
    
    This has caused the setUp() method to not be executed in certain
    cases, and the test method proceeds without finding its environment
    set up (common situation when not running setUp(), one ends up with
    missing attributes, in the class and cryptic errors during the
    execution of the test).
    
    This evaluates the same conditions used for skipping the test, but
    also for skipping the setUp() method.  Unfortunately, we have to
    distinguish between the condition and the decorator itself because
    if we don't, we may end up running the decorated function (usually
    the test) twice.
    
    Signed-off-by: Cleber Rosa <crosa@redhat.com>
    clebergnu committed Apr 13, 2021
    Configuration menu
    Copy the full SHA
    3c3f30d View commit details
    Browse the repository at this point in the history