当前位置: 首页>>代码示例>>Python>>正文


Python testutils.ConnectingTestCase类代码示例

本文整理汇总了Python中testutils.ConnectingTestCase的典型用法代码示例。如果您正苦于以下问题:Python ConnectingTestCase类的具体用法?Python ConnectingTestCase怎么用?Python ConnectingTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ConnectingTestCase类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tearDown

    def tearDown(self):
        curs = self.conn.cursor()
        curs.execute("DROP TABLE table1")
        curs.execute("DROP TABLE table2")
        self.conn.commit()

        ConnectingTestCase.tearDown(self)
开发者ID:SvetlanaM,项目名称:EnabledCityPaloAlto,代码行数:7,代码来源:test_transaction.py

示例2: setUp

 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.curs = self.conn.cursor()
     self.DATE = psycopg2.extensions.PYDATE
     self.TIME = psycopg2.extensions.PYTIME
     self.DATETIME = psycopg2.extensions.PYDATETIME
     self.INTERVAL = psycopg2.extensions.PYINTERVAL
开发者ID:coldmind,项目名称:psycopg2,代码行数:7,代码来源:test_dates.py

示例3: setUp

    def setUp(self):
        ConnectingTestCase.setUp(self)

        cur = self.conn.cursor()
        cur.execute('''
            CREATE TEMPORARY TABLE table1 (
              id int PRIMARY KEY
            )''')
        self.conn.commit()
开发者ID:Oakafee,项目名称:Interpretation-of-New-Jersey,代码行数:9,代码来源:test_async_keyword.py

示例4: setUp

 def setUp(self):
     ConnectingTestCase.setUp(self)
     curs = self.conn.cursor()
     try:
         curs.execute("delete from test_with")
         self.conn.commit()
     except psycopg2.ProgrammingError:
         # assume table doesn't exist
         self.conn.rollback()
         curs.execute("create table test_with (id integer primary key)")
         self.conn.commit()
开发者ID:Oakafee,项目名称:Interpretation-of-New-Jersey,代码行数:11,代码来源:test_with.py

示例5: setUp

    def setUp(self):
        ConnectingTestCase.setUp(self)

        self.sync_conn = self.conn
        self.conn = self.connect(async=True)

        self.wait(self.conn)

        curs = self.conn.cursor()
        curs.execute('''
            CREATE TEMPORARY TABLE table1 (
              id int PRIMARY KEY
            )''')
        self.wait(curs)
开发者ID:axwack,项目名称:rebalancer,代码行数:14,代码来源:test_async.py

示例6: setUp

    def setUp(self):
        ConnectingTestCase.setUp(self)
        from psycopg2.extras import NamedTupleConnection

        try:
            from collections import namedtuple
        except ImportError:
            return

        self.conn = self.connect(connection_factory=NamedTupleConnection)
        curs = self.conn.cursor()
        curs.execute("CREATE TEMPORARY TABLE nttest (i int, s text)")
        curs.execute("INSERT INTO nttest VALUES (1, 'foo')")
        curs.execute("INSERT INTO nttest VALUES (2, 'bar')")
        curs.execute("INSERT INTO nttest VALUES (3, 'baz')")
        self.conn.commit()
开发者ID:13lcp2000,项目名称:recetario4-4,代码行数:16,代码来源:test_extras_dictcursor.py

示例7: tearDown

    def tearDown(self):
        if self.tmpdir:
            shutil.rmtree(self.tmpdir, ignore_errors=True)

        if self.conn.closed:
            return

        if self.lo_oid is not None:
            self.conn.rollback()
            try:
                lo = self.conn.lobject(self.lo_oid, "n")
            except psycopg2.OperationalError:
                pass
            else:
                lo.unlink()

        ConnectingTestCase.tearDown(self)
开发者ID:Oakafee,项目名称:Interpretation-of-New-Jersey,代码行数:17,代码来源:test_lobject.py

示例8: setUp

 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.conn.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE)
     curs = self.conn.cursor()
     curs.execute('''
         CREATE TEMPORARY TABLE table1 (
           id int PRIMARY KEY
         )''')
     # The constraint is set to deferrable for the commit_failed test
     curs.execute('''
         CREATE TEMPORARY TABLE table2 (
           id int PRIMARY KEY,
           table1_id int,
           CONSTRAINT table2__table1_id__fk
             FOREIGN KEY (table1_id) REFERENCES table1(id) DEFERRABLE)''')
     curs.execute('INSERT INTO table1 VALUES (1)')
     curs.execute('INSERT INTO table2 VALUES (1, 1)')
     self.conn.commit()
开发者ID:SvetlanaM,项目名称:EnabledCityPaloAlto,代码行数:18,代码来源:test_transaction.py

示例9: setUp

 def setUp(self):
     ConnectingTestCase.setUp(self)
     self._create_temp_table()
开发者ID:4bic-attic,项目名称:scrape,代码行数:3,代码来源:test_copy.py

示例10: setUp

 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.lo_oid = None
     self.tmpdir = None
开发者ID:Oakafee,项目名称:Interpretation-of-New-Jersey,代码行数:4,代码来源:test_lobject.py

示例11: connect

 def connect(self):
     conn = ConnectingTestCase.connect(self)
     conn.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE)
     return conn
开发者ID:SvetlanaM,项目名称:EnabledCityPaloAlto,代码行数:4,代码来源:test_transaction.py

示例12: setUp

 def setUp(self):
     self._cb = psycopg2.extensions.get_wait_callback()
     psycopg2.extensions.set_wait_callback(self.crappy_callback)
     ConnectingTestCase.setUp(self)
     self.to_error = None
开发者ID:gopal-neosoft,项目名称:Assignment,代码行数:5,代码来源:test_green.py


注:本文中的testutils.ConnectingTestCase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。