def test_commandLine(self): """ L{ListVersions} will list versions of code used in this store when invoked as an axiomatic subcommand. """ checkSystemVersion(self.store) out = StringIO.StringIO() self.patch(sys, "stdout", out) lv = ListVersions() lv.parent = self lv.parseOptions([]) result = out.getvalue() self.assertSubstring("axiom: " + axiom_version.short(), result)
def test_commandLine(self): """ L{ListVersions} will list versions of code used in this store when invoked as an axiomatic subcommand. """ checkSystemVersion(self.store) out = StringIO.StringIO() self.patch(sys, 'stdout', out) lv = ListVersions() lv.parent = self lv.parseOptions([]) result = out.getvalue() self.assertSubstring("axiom: " + axiom_version.short(), result)
def test_checkSystemVersion(self): """ Calling checkSystemVersion: 1. Doesn't duplicate the system version when called with the same software package versions. 2. Creates a new system version when one of the software package versions has changed. 3. Notices and creates a new system version when the system config has reverted to a previous state. """ versions = [Version("foo", 1, 2, 3)] checkSystemVersion(self.store, versions) checkSystemVersion(self.store, versions) query_results = list(self.store.query(SystemVersion)) self.assertEquals(len(query_results), 1) # Adjust a version number and try again. v = versions[0] versions[0] = Version(v.package, v.major, v.minor + 1, v.micro) checkSystemVersion(self.store, versions) query_results = list(self.store.query(SystemVersion)) self.assertEquals(len(query_results), 2) # Revert the version number and try again. versions[0] = v checkSystemVersion(self.store, versions) query_results = list(self.store.query(SystemVersion)) self.assertEquals(len(query_results), 3) # Reopening the store does not duplicate the version. self._reopenStore() query_results = list(self.store.query(SystemVersion)) self.assertEquals(len(query_results), 3)
def startService(self): from axiom.listversions import checkSystemVersion checkSystemVersion(self.store)