Beispiel #1
0
 def invoke_top_reconcile(self,
                          current_lines,
                          reconcile=None,
                          no_save=None):
     """
     Helper function to invoke the top-level reconcile
     :return:
     """
     result = bond_reconcile.reconcile_observations(dict(reconcile=reconcile),
                                                    'test 1',
                                                    self.reference_file,
                                                    current_lines,
                                                    no_save=no_save)
     # Observe the directory
     bond.spy('invoke_top_reconcile_results',
              result=result,
              observation_dir=collect_directory_contents(self.testing_observation_dir,
                                                         collect_file_contents=True))
Beispiel #2
0
    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)