コード例 #1
0
ファイル: test_sqlalchemy.py プロジェクト: ropex/oslo.db
 def test_mysql_mysqldb_connect_args_default(self):
     session._init_connection_args(
         url.make_url("mysql+mysqldb://u:p@host/test"), self.args)
     self.assertEqual(self.args['connect_args'], {
         'charset': 'utf8',
         'use_unicode': 0
     })
コード例 #2
0
ファイル: test_sqlalchemy.py プロジェクト: ropex/oslo.db
 def test_queuepool_args(self):
     session._init_connection_args(url.make_url("mysql://*****:*****@host/test"),
                                   self.args,
                                   max_pool_size=10,
                                   max_overflow=10)
     self.assertEqual(self.args['pool_size'], 10)
     self.assertEqual(self.args['max_overflow'], 10)
コード例 #3
0
    def test_mysqlconnector_raise_on_warnings_override(self):
        session._init_connection_args(
            url.make_url(
                "mysql+mysqlconnector://u:p@host/test"
                "?raise_on_warnings=true"),
            self.args
        )

        self.assertFalse('raise_on_warnings' in self.args['connect_args'])
コード例 #4
0
    def test_sqlite_file_pool_args(self):
        session._init_connection_args(
            url.make_url("sqlite:///somefile.db"), self.args,
            max_pool_size=10, max_overflow=10)

        # queuepool arguments are not peresnet
        self.assertTrue('pool_size' not in self.args)
        self.assertTrue(
            'max_overflow' not in self.args)

        self.assertFalse(self.args['connect_args'])

        # NullPool is the default for file based connections,
        # no need to specify this
        self.assertTrue('poolclass' not in self.args)
コード例 #5
0
ファイル: test_sqlalchemy.py プロジェクト: ropex/oslo.db
    def test_sqlite_memory_pool_args(self):
        for _url in ("sqlite://", "sqlite:///:memory:"):
            session._init_connection_args(url.make_url(_url),
                                          self.args,
                                          max_pool_size=10,
                                          max_overflow=10)

            # queuepool arguments are not peresnet
            self.assertTrue('pool_size' not in self.args)
            self.assertTrue('max_overflow' not in self.args)

            self.assertEqual(self.args['connect_args']['check_same_thread'],
                             False)

            # due to memory connection
            self.assertTrue('poolclass' in self.args)
コード例 #6
0
    def test_sqlite_memory_pool_args(self):
        for _url in ("sqlite://", "sqlite:///:memory:"):
            session._init_connection_args(
                url.make_url(_url), self.args,
                max_pool_size=10, max_overflow=10)

            # queuepool arguments are not peresnet
            self.assertTrue(
                'pool_size' not in self.args)
            self.assertTrue(
                'max_overflow' not in self.args)

            self.assertEqual(self.args['connect_args']['check_same_thread'],
                             False)

            # due to memory connection
            self.assertTrue('poolclass' in self.args)
コード例 #7
0
 def test_mysqlconnector_raise_on_warnings_default(self):
     session._init_connection_args(
         url.make_url("mysql+mysqlconnector://u:p@host/test"),
         self.args)
     self.assertEqual(self.args['connect_args']['raise_on_warnings'], False)
コード例 #8
0
 def test_postgresql_connect_args_default(self):
     session._init_connection_args(
         url.make_url("postgresql://*****:*****@host/test"), self.args)
     self.assertEqual(self.args['client_encoding'], 'utf8')
     self.assertFalse(self.args['connect_args'])
コード例 #9
0
 def test_mysql_mysqldb_connect_args_default(self):
     session._init_connection_args(
         url.make_url("mysql+mysqldb://u:p@host/test"), self.args)
     self.assertEqual(self.args['connect_args'],
                      {'charset': 'utf8', 'use_unicode': 0})
コード例 #10
0
 def test_queuepool_args(self):
     session._init_connection_args(
         url.make_url("mysql://*****:*****@host/test"), self.args,
         max_pool_size=10, max_overflow=10)
     self.assertEqual(self.args['pool_size'], 10)
     self.assertEqual(self.args['max_overflow'], 10)