コード例 #1
0
ファイル: testcase.py プロジェクト: petrus-v/AnyBlok
    def tearDown(self):
        """ Clear the registry, unload the blok manager and  drop the database
        """
        if self.registry:
            self.registry.close()

        RegistryManager.clear()
        BlokManager.unload()
        super(DBTestCase, self).tearDown()
コード例 #2
0
ファイル: scripts.py プロジェクト: AnyBlok/anyblok_dramatiq
 def termhandler(signum, frame):
     nonlocal running
     BlokManager.unload()
     if running:
         logger.info("Stopping worker process...")
         running = False
     else:
         logger.warning("Killing worker process...")
         return os._exit(1)
コード例 #3
0
ファイル: testcase.py プロジェクト: gracinet/AnyBlok
    def tearDown(self):
        """ Clear the registry, unload the blok manager and  drop the database
        """
        if self.registry:
            self.registry.close()

        RegistryManager.clear()
        BlokManager.unload()
        clear_mappers()
        super(DBTestCase, self).tearDown()
コード例 #4
0
 def tearDown(self):
     """ Clear the registry, unload the blok manager and  drop the database
     """
     registry = RegistryManager.get(Configuration.get('db_name'))
     registry.close()
     RegistryManager.clear()
     BlokManager.unload()
     clear_mappers()
     self.__class__.dropdb()
     super(TestBlok, self).tearDown()
コード例 #5
0
    def test_start_function(self):
        BlokManager.unload()
        db_name = Configuration.get('db_name') or 'test_anyblok'
        db_driver_name = Configuration.get('db_driver_name') or 'postgresql'

        testargs = ['default', '--db-name', db_name, '--db-driver-name',
                    db_driver_name]
        with patch.object(sys, 'argv', testargs):
            registry = start('default')

        assert registry is not None
コード例 #6
0
ファイル: test_registry.py プロジェクト: AnyBlok/AnyBlok
    def test_start_function(self):
        BlokManager.unload()
        db_name = Configuration.get('db_name') or 'test_anyblok'
        db_driver_name = Configuration.get('db_driver_name') or 'postgresql'

        testargs = ['default', '--db-name', db_name, '--db-driver-name',
                    db_driver_name]
        with patch.object(sys, 'argv', testargs):
            registry = start('default')

        self.assertIsNotNone(registry)
コード例 #7
0
ファイル: testcase.py プロジェクト: gracinet/AnyBlok
    def setUpClass(cls):
        """ Intialialise the configuration manager """

        super(DBTestCase, cls).setUpClass()
        cls.init_configuration_manager()
        if cls.createdb(keep_existing=True):
            BlokManager.load(entry_points=('bloks', 'test_bloks'))
            registry = cls.getRegistry()
            registry.commit()
            registry.close()
            BlokManager.unload()
コード例 #8
0
def base_loaded(request):
    url = Configuration.get('get_url')()
    if not database_exists(url):
        db_template_name = Configuration.get('db_template_name', None)
        create_database(url, template=db_template_name)

    BlokManager.load()
    registry = init_registry_with_bloks([], None)
    registry.commit()
    registry.close()
    BlokManager.unload()
コード例 #9
0
ファイル: testcase.py プロジェクト: jssuzanne/AnyBlok
    def setUpClass(cls):
        """ Intialialise the configuration manager """

        super(DBTestCase, cls).setUpClass()
        cls.init_configuration_manager()
        if cls.createdb(keep_existing=True):
            BlokManager.load(entry_points=('bloks', 'test_bloks'))
            registry = cls.getRegistry()
            registry.commit()
            registry.close()
            BlokManager.unload()
コード例 #10
0
 def test_anyblok_core_loaded(self):
     BlokManager.load()
     is_exist = 'anyblok-core' in RegistryManager.loaded_bloks
     self.assertEqual(is_exist, True)
     anyblokcore = RegistryManager.loaded_bloks['anyblok-core']
     self.assertEqual(len(anyblokcore['Core']['Base']), 1)
     self.assertEqual(len(anyblokcore['Core']['SqlBase']), 1)
     self.assertEqual(len(anyblokcore['Core']['SqlViewBase']), 1)
     self.assertEqual(len(anyblokcore['Core']['Session']), 1)
     self.assertEqual(len(anyblokcore['Core']['Query']), 1)
     self.assertEqual(len(anyblokcore['Core']['InstrumentedList']), 1)
     is_exist = 'Model.System' in anyblokcore['Model']
     self.assertEqual(is_exist, True)
     BlokManager.unload()
コード例 #11
0
 def test_anyblok_core_loaded(self):
     BlokManager.load()
     is_exist = 'anyblok-core' in RegistryManager.loaded_bloks
     assert is_exist
     anyblokcore = RegistryManager.loaded_bloks['anyblok-core']
     assert len(anyblokcore['Core']['Base']) == 1
     assert len(anyblokcore['Core']['SqlBase']) == 1
     assert len(anyblokcore['Core']['SqlViewBase']) == 1
     assert len(anyblokcore['Core']['Session']) == 1
     assert len(anyblokcore['Core']['Query']) == 1
     assert len(anyblokcore['Core']['InstrumentedList']) == 1
     is_exist = 'Model.System' in anyblokcore['Model']
     assert is_exist
     BlokManager.unload()
コード例 #12
0
 def test_anyblok_core_loaded(self):
     BlokManager.load()
     is_exist = 'anyblok-core' in RegistryManager.loaded_bloks
     self.assertEqual(is_exist, True)
     anyblokcore = RegistryManager.loaded_bloks['anyblok-core']
     self.assertEqual(len(anyblokcore['Core']['Base']), 1)
     self.assertEqual(len(anyblokcore['Core']['SqlBase']), 1)
     self.assertEqual(len(anyblokcore['Core']['SqlViewBase']), 1)
     self.assertEqual(len(anyblokcore['Core']['Session']), 1)
     self.assertEqual(len(anyblokcore['Core']['Query']), 1)
     self.assertEqual(len(anyblokcore['Core']['InstrumentedList']), 1)
     is_exist = 'Model.System' in anyblokcore['Model']
     self.assertEqual(is_exist, True)
     BlokManager.unload()
コード例 #13
0
def base_loaded(request, configuration_loaded):
    if sgdb_in(['MySQL', 'MariaDB']):
        return

    url = Configuration.get('get_url')()
    if not database_exists(url):
        db_template_name = Configuration.get('db_template_name', None)
        create_database(url, template=db_template_name)

    BlokManager.load()
    registry = init_registry_with_bloks([], None)
    registry.commit()
    registry.close()
    BlokManager.unload()
コード例 #14
0
ファイル: test_blok.py プロジェクト: petrus-v/AnyBlok
 def tearDown(self):
     super(TestBlokManager, self).tearDown()
     BlokManager.unload()
コード例 #15
0
 def test_reload_blok(self):
     BlokManager.load()
     try:
         RegistryManager.reload()
     finally:
         BlokManager.unload()
コード例 #16
0
 def tearDownClass(cls):
     super(TestMigration, cls).tearDownClass()
     BlokManager.unload()
     RegistryManager.loaded_bloks = cls.loaded_bloks
     cls.dropdb()
コード例 #17
0
ファイル: test_migration.py プロジェクト: AnyBlok/AnyBlok
 def tearDownClass(cls):
     super(TestMigration, cls).tearDownClass()
     BlokManager.unload()
     RegistryManager.loaded_bloks = cls.loaded_bloks
     cls.dropdb()
コード例 #18
0
 def tearDown(self):
     super(TestBlokManager, self).tearDown()
     BlokManager.unload()
コード例 #19
0
 def test_reload_blok(self):
     BlokManager.load()
     try:
         RegistryManager.reload()
     finally:
         BlokManager.unload()
コード例 #20
0
ファイル: test_blok_manager.py プロジェクト: zakibelm/AnyBlok
 def bloks_must_be_unloaded(self, request):
     request.addfinalizer(BlokManager.unload)
     BlokManager.unload()