1# Copyright (c) 2017 Mark D. Hill and David A. Wood 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 18 unchanged lines hidden (view full) --- 27# Authors: Sean Wilson 28 29import copy 30import traceback 31 32import helper 33import log 34 |
35class SkipException(Exception): 36 def __init__(self, fixture, testitem): 37 self.fixture = fixture 38 self.testitem = testitem 39 40 self.msg = 'Fixture "%s" raised SkipException for "%s".' % ( 41 fixture.name, testitem.name 42 ) --- 21 unchanged lines hidden (view full) --- 64 obj = super(Fixture, klass).__new__(klass, *args, **kwargs) 65 Fixture.collector.collect(obj) 66 return obj 67 68 def __init__(self, name=None, **kwargs): 69 if name is None: 70 name = self.__class__.__name__ 71 self.name = name |
72 self._is_global = False |
73 74 def skip(self, testitem): 75 raise SkipException(self.name, testitem.metadata) 76 |
77 def init(self, *args, **kwargs): 78 pass 79 80 def setup(self, testitem): 81 pass 82 83 def teardown(self, testitem): 84 pass 85 |
86 def skip_cleanup(self): 87 ''' 88 If this method is called, then we should make sure that nothing is 89 done when the teardown() function is called. 90 ''' 91 pass 92 |
93 def set_global(self): 94 self._is_global = True |
95 |
96 def is_global(self): 97 return self._is_global |