def test_reset_spy_groups(self): self.annotated_method_group_enabled() self.annotated_method_no_group() bond.settings(spy_groups='group2') bond.spy(msg='spy groups set') self.annotated_method_group_enabled() self.annotated_method_no_group() bond.settings(spy_groups=()) bond.spy(msg='spy groups reset', obs_dir=os.path.basename(os.path.normpath(bond.Bond.instance()._observation_directory()))) self.annotated_method_group_enabled() self.annotated_method_no_group()
def test_spy_create_dir(self): "Test the creation of the observation directory" test_dir = '/tmp/bondTestOther' bond.settings(observation_directory=test_dir, reconcile='accept') if os.path.isdir(test_dir): shutil.rmtree(test_dir) bond.spy(spy_point_name='first_observation', val=1) bond.spy(spy_point_name='second_observation', val=2) # Now spy the contents of the observation directory itself bond_instance = bond.Bond.instance() bond_instance._finish_test() # We reach into the internal API bond_instance.test_framework_bridge = bond.TestFrameworkBridge.make_bridge(self) # Has to allow the test to continue bond.spy('collect_spy_observation_dirs', directory=bond_helpers.collect_directory_contents(test_dir, collect_file_contents=True)) # Now we delete the observation directory, which we already collected above. # Otherwise, the test will try to reconcile with it shutil.rmtree(test_dir)
def teardown_bond_self_test(test_instance): test_instance.during_test = False # Change the settings to use a console reconcile for the end of the test bond.settings(reconcile=os.environ.get('BOND_RECONCILE', 'console'))
def test_no_observation_directory(self): # Update the settings bond.settings(spy_groups=None, observation_directory=None)
def test_no_spy_groups(self): # Update the settings bond.settings(spy_groups=None)
def test_with_groups_disabled(self): "Test annotations enabled for specific groups, when the group is NOT enabled" bond.settings(spy_groups='group_other') self.annotated_standard_method_enabled_for_groups(arg1=1, arg2=2)
def test_with_groups_enabled2(self): "Test annotations enabled for specific groups, when the group is enabled, as a string" bond.settings(spy_groups=('group_other', 'group2')) self.annotated_standard_method_enabled_for_single_group(arg1=1, arg2=2)
def test_with_groups_enabled(self): "Test annotations enabled for specific groups, when the group is enabled, as a tuple" bond.settings(spy_groups=("group_other", "group2")) self.annotated_standard_method_enabled_for_groups(arg1=1, arg2=2)