Changeset 771 for branches/4.x


Ignore:
Timestamp:
Jan 20, 2016, 1:22:10 PM (4 years ago)
Author:
cito
Message:

Back port some minor fixes from the trunk

This also gives better error message if test runner does not support unittest2.

Location:
branches/4.x
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/4.x/docs/contents/pg/db_wrapper.rst

    r769 r771  
    145145    :rtype: str, list or dict
    146146    :raises TypeError: Invalid parameter type(s)
    147     :raises ProgrammingError: Invalid parameter name(s)
     147    :raises pg.ProgrammingError: Invalid parameter name(s)
    148148
    149149If the parameter is a string, the return value will also be a string
     
    163163.. versionadded:: 4.2
    164164
    165 .. method:: DB.set_parameter(self, parameter, [value], [local])
     165.. method:: DB.set_parameter(parameter, [value], [local])
    166166
    167167    Set the value of run-time parameters
     
    173173    :raises TypeError: Invalid parameter type(s)
    174174    :raises ValueError: Invalid value argument(s)
    175     :raises ProgrammingError: Invalid parameter name(s) or values
     175    :raises pg.ProgrammingError: Invalid parameter name(s) or values
    176176
    177177If the parameter and the value are strings, the run-time parameter
     
    296296    :returns: A dictionary - the keys are the attribute names,
    297297      the values are the row values.
    298     :raises ProgrammingError: no primary key or missing privilege
     298    :raises pg.ProgrammingError: no primary key or missing privilege
    299299
    300300This method is the basic mechanism to get a single row.  It assumes
     
    319319    :returns: the inserted values in the database
    320320    :rtype: dict
    321     :raises ProgrammingError: missing privilege or conflict
     321    :raises pg.ProgrammingError: missing privilege or conflict
    322322
    323323This method inserts a row into a table.  If the optional dictionary is
     
    340340    :returns: the new row in the database
    341341    :rtype: dict
    342     :raises ProgrammingError: no primary key or missing privilege
     342    :raises pg.ProgrammingError: no primary key or missing privilege
    343343
    344344Similar to insert but updates an existing row.  The update is based on the
     
    413413    :param dict d: optional dictionary of values
    414414    :rtype: None
    415     :raises ProgrammingError: table has no primary key,
     415    :raises pg.ProgrammingError: table has no primary key,
    416416        row is still referenced or missing privilege
    417417
     
    421421row did not exist and 1 if the row was deleted).
    422422
    423 truncate -- Quickly empty database tables
     423truncate -- quickly empty database tables
    424424-----------------------------------------
    425425
    426 .. method:: DB.truncate(self, table, [restart], [cascade], [only]):
     426.. method:: DB.truncate(table, [restart], [cascade], [only])
    427427
    428428    Empty a table or set of tables
  • branches/4.x/pg.py

    r769 r771  
    11631163        q = ' '.join(q)
    11641164        self._do_debug(q)
    1165         return self.query(q)
     1165        return self.db.query(q)
    11661166
    11671167    def notification_handler(self,
  • branches/4.x/tests/test_classic_connection.py

    r731 r771  
    663663    """Test inserttable method."""
    664664
     665    cls_set_up = False
     666
    665667    @classmethod
    666668    def setUpClass(cls):
     
    672674            "c char(1), v4 varchar(4), c4 char(4), t text)")
    673675        c.close()
     676        cls.cls_set_up = True
    674677
    675678    @classmethod
     
    680683
    681684    def setUp(self):
     685        self.assertTrue(self.cls_set_up)
    682686        self.c = connect()
    683687        self.c.query("set lc_monetary='C'")
     
    788792    """Test copy command with direct socket access."""
    789793
     794    cls_set_up = False
     795
    790796    @classmethod
    791797    def setUpClass(cls):
     
    794800        c.query("create table test (i int, v varchar(16))")
    795801        c.close()
     802        cls.cls_set_up = True
    796803
    797804    @classmethod
     
    802809
    803810    def setUp(self):
     811        self.assertTrue(self.cls_set_up)
    804812        self.c = connect()
    805813        self.c.query("set datestyle='ISO,YMD'")
  • branches/4.x/tests/test_classic_dbwrapper.py

    r763 r771  
    278278    """Test the methods of the DB class wrapped pg connection."""
    279279
     280    cls_set_up = False
     281
    280282    @classmethod
    281283    def setUpClass(cls):
     
    289291            " select i4, v4 from test")
    290292        db.close()
     293        cls.cls_set_up = True
    291294
    292295    @classmethod
     
    297300
    298301    def setUp(self):
     302        self.assertTrue(self.cls_set_up)
    299303        self.db = DB()
    300304        query = self.db.query
     
    15691573    """Test correct handling of schemas (namespaces)."""
    15701574
     1575    cls_set_up = False
     1576
    15711577    @classmethod
    15721578    def setUpClass(cls):
     
    15921598                  % (schema, num_schema, num_schema))
    15931599        db.close()
     1600        cls.cls_set_up = True
    15941601
    15951602    @classmethod
     
    16081615
    16091616    def setUp(self):
     1617        self.assertTrue(self.cls_set_up)
    16101618        self.db = DB()
    16111619
Note: See TracChangeset for help on using the changeset viewer.