#! /usr/bin/env avocado-runner-avocado-classless """ Example avocado-classless style tests. Note that some of these are expected to fail. """ import sys import time from avocado_classless.test import classless_test, test, test_output @test def trivial_pass(): print("Passes, trivially") @test def trivial_fail(): print("Fails, trivially", file=sys.stderr) assert False # Some test_output checks def is_integer(val): assert isinstance(val, int) def is_positive(val): assert val > 0 @test_output(is_integer, is_positive) def positive_integer(): return 17 @test_output(is_integer, is_positive) def negative_integer(): return -17 @test_output(is_integer, is_positive) def positive_fraction(): return 3.5 @test_output(is_integer, is_positive) def negative_fraction(): return -3.5 @classless_test(timeout=1.0) def timeout(): time.sleep(3)