def test_get_git_commit_without_git(self, mock): mock.side_effect = InvalidGitRepositoryError() self.assertEqual(('unknown', '', ANY), get_git_commit())
def __init__(self): # Warning; # If new data is added with a site dimension the # clip exposure function may need to be updated # so the site data stays consistent. # -------------- These variables are saved ---- # If new variables are added the save functions # will need to be modified. # Latitude and longitude values of the exposure data # Has a site dimension self.exposure_lat = None self.exposure_long = None # Data with a site dimension # key - data name # value - A numpy array. First dimension is site. (0 axis) # Has a site dimension self.exposure_att = None # Data for aggregation across sites self.exposure_agg = None # # -------------- The above variables are saved ---- # key - intensity measure # value - One instance of RealisedVulnerabilityCurves. An att in this # class has a site dimension. self.exposure_vuln_curves = None # A dictionary of the vulnerability sets. # Not associated with exposures. # key - vulnerability set ID # value - vulnerability set instance self.vulnerability_sets = {} # A dictionary with keys being vulnerability_set_ids and # value being the exposure attribute who's values are vulnerability # function ID's. self.vul_function_titles = {} # A `prov.ProvDocument` to manage provenance information, including # adding required namespaces self.prov = ProvDocument() self.prov.set_default_namespace("") self.prov.add_namespace('prov', 'http://www.w3.org/ns/prov#') self.prov.add_namespace('xsd', 'http://www.w3.org/2001/XMLSchema#') self.prov.add_namespace('foaf', 'http://xmlns.com/foaf/0.1/') self.prov.add_namespace('void', 'http://vocab.deri.ie/void#') self.prov.add_namespace('dcterms', 'http://purl.org/dc/terms/') commit, branch, dt = misc.get_git_commit() # Create the fundamental software agent that is this code: self.prov.agent( ":hazimp", { "prov:type": "prov:SoftwareAgent", "prov:Revision": commit, "prov:branch": branch, "prov:date": dt }) self.prov.agent(f":{getpass.getuser()}", {"prov:type": "foaf:Person"}) self.prov.actedOnBehalfOf(":hazimp", f":{getpass.getuser()}") self.provlabel = ''
def test_get_git_commit(self): self.assertEqual((ANY, ANY, ANY), get_git_commit())