Projet

Général

Profil

0004-sql-always-init-global-forms-table-in-tests-60552.patch

Frédéric Péters, 25 mars 2022 14:53

Télécharger (1,52 ko)

Voir les différences:

Subject: [PATCH 4/9] sql: always init global forms table in tests (#60552)

 tests/utilities.py |  1 +
 wcs/sql.py         | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
tests/utilities.py
179 179
        sql.do_snapshots_table()
180 180
        sql.do_loggederrors_table()
181 181
        sql.do_meta_table()
182
        sql.init_global_table()
182 183

  
183 184
        conn.close()
184 185

  
wcs/sql.py
1733 1733
        )
1734 1734

  
1735 1735

  
1736
def init_global_table(conn, cur):
1736
def init_global_table(conn=None, cur=None):
1737 1737
    from .carddef import CardDef
1738 1738
    from .formdef import FormDef
1739 1739

  
1740
    own_conn = False
1741
    if not conn:
1742
        own_conn = True
1743
        conn, cur = get_connection_and_cursor()
1744

  
1740 1745
    cur.execute("SELECT relkind FROM pg_class WHERE relname = 'wcs_all_forms';")
1741 1746
    rows = cur.fetchall()
1742 1747
    if len(rows) != 0:
......
1815 1820
            )
1816 1821
        )
1817 1822

  
1823
    if own_conn:
1824
        conn.commit()
1825
        cur.close()
1826

  
1818 1827

  
1819 1828
class SqlMixin:
1820 1829
    _table_name = None
1821
-