Пример #1
0
 def testMissingAttributes(self):
     """Test for instantiating a registry against outdated schema which
     misses butler_attributes table.
     """
     # TODO: Once we have stable gen3 schema everywhere this test can be
     # dropped (DM-27373).
     config = self.makeRegistryConfig()
     config["db"] = "sqlite://"
     with self.assertRaises(MissingAttributesTableError):
         Registry.fromConfig(config)
Пример #2
0
 def makeRegistry(self) -> Registry:
     prefix = f"test_{secrets.token_hex(8).lower()}_"
     self._prefixes.append(prefix)
     config = self.makeRegistryConfig()
     # Can't use Registry.fromConfig for these tests because we don't want
     # to reconnect to the server every single time.  But we at least use
     # OracleDatabase.fromConnection rather than the constructor so
     # we can try to pass a prefix through via "+" in a namespace.
     database = OracleDatabase.fromConnection(connection=self._connection,
                                              origin=0,
                                              namespace=f"+{prefix}")
     attributes = doImport(config["managers", "attributes"])
     opaque = doImport(config["managers", "opaque"])
     dimensions = doImport(config["managers", "dimensions"])
     collections = doImport(config["managers", "collections"])
     datasets = doImport(config["managers", "datasets"])
     datastoreBridges = doImport(config["managers", "datastores"])
     return Registry(database=database,
                     attributes=attributes,
                     opaque=opaque,
                     dimensions=dimensions,
                     collections=collections,
                     datasets=datasets,
                     datastoreBridges=datastoreBridges,
                     universe=DimensionUniverse(config),
                     create=True)
Пример #3
0
 def makeRegistry(self) -> Registry:
     prefix = f"test_{secrets.token_hex(8).lower()}_"
     self._prefixes.append(prefix)
     config = RegistryConfig()
     # Can't use Registry.fromConfig for these tests because we don't want
     # to reconnect to the server every single time.  But we at least use
     # OracleDatabase.fromConnection rather than the constructor so
     # we can try to pass a prefix through via "+" in a namespace.
     database = OracleDatabase.fromConnection(connection=self._connection,
                                              origin=0,
                                              namespace=f"+{prefix}")
     return Registry(database=database,
                     dimensions=DimensionUniverse(config),
                     create=True)
Пример #4
0
 def makeRegistry(self) -> Registry:
     config = self.makeRegistryConfig()
     config["db"] = "sqlite://"
     return Registry.createFromConfig(config)
Пример #5
0
 def makeRegistry(self) -> Registry:
     _, filename = tempfile.mkstemp(dir=self.root, suffix=".sqlite3")
     config = self.makeRegistryConfig()
     config["db"] = f"sqlite:///{filename}"
     return Registry.createFromConfig(config, butlerRoot=self.root)
Пример #6
0
 def makeRegistry(self) -> Registry:
     namespace = f"namespace_{secrets.token_hex(8).lower()}"
     config = self.makeRegistryConfig()
     config["db"] = self.server.url()
     config["namespace"] = namespace
     return Registry.fromConfig(config, create=True)
Пример #7
0
 def makeRegistry(self) -> Registry:
     config = RegistryConfig()
     config["db"] = f"sqlite://"
     return Registry.fromConfig(config, create=True)