Esempio n. 1
0
    def __init__(self, port=None):
        self._logger = logging.getLogger(__name__)
        self._port_num = port
        self._auth_token = "fake_auth_token"
        self._tempDirObj = tempfile.TemporaryDirectory()
        self._cleanupFns = []

        self.startObjectDB()

        self.serviceManager = SubprocessServiceManager(
            "localhost",
            "localhost",
            self._port_num,
            os.path.join(self.tempDir, "code"),
            os.path.join(self.tempDir, "storage"),
            self._auth_token,
            isMaster=True,
            shutdownTimeout=.25,
            maxGbRam=
            128,  # our simulated services don't actually use this much, but we need to reserve
            maxCores=16  # enough to be able to do the simulation.
        )
        self.serializationContext = TypedPythonCodebase.FromRootlevelModule(
            research_app).serializationContext

        self.serviceManager.start()
        self.db = self.connect()
        self.db.subscribeToSchema(service_schema)
        self.db.setSerializationContext(self.serializationContext)

        self.researchFrontendHelper = ResearchFrontendTestHelper(self)
        self.webServiceHelper = WebServiceHelper(self)
    def test_create_current_codebase(self):
        cb = Codebase.FromRootlevelModule(typed_python)

        serializer = cb.serializationContext

        self.assertIs(
            serializer.deserialize(serializer.serialize(thisIsAFunction)),
            thisIsAFunction
        )
    def setUp(self):
        self.harness = ServiceTestHarness()
        self.harness.researchFrontendHelper.createResearchFrontend()

        self.ser_ctx = TypedPythonCodebase.FromRootlevelModule(research_app).serializationContext
Esempio n. 4
0
 def getSerializationContext(self):
     if self.codebase is None:
         return TypedPythonCodebase.FromRootlevelModule(
             object_database).serializationContext
     else:
         return self.codebase.instantiate().serializationContext
def hashCurrentCodebase():
    return TypedPythonCodebase.FromRootlevelModule(research_app,
                                                   ignoreCache=True).hash()
 def serializeFromModule(self, module):
     """Give the project root we want to serialize from."""
     self.setSerializationContext(
         TypedPythonCodebase.FromRootlevelModule(
             module).serializationContext)
 def __init__(self, service_test_base ):
     self._base = service_test_base
     self._db = None
     self.ser_ctx = TypedPythonCodebase.FromRootlevelModule(research_app).serializationContext