Skip to content
Snippets Groups Projects
Commit 2b70a7b4 authored by Jakub Maloštík's avatar Jakub Maloštík
Browse files

Fix Python2 compatibility of test_warden_server

parent 75d75041
Branches
No related tags found
No related merge requests found
...@@ -539,16 +539,14 @@ class PostgreSQL: ...@@ -539,16 +539,14 @@ class PostgreSQL:
conn.close() conn.close()
def _load_tags(self, cur): def _load_tags(self, cur):
with open(path.join(path.dirname(__file__), "tagmap_db.json"), with open(path.join(path.dirname(__file__), "tagmap_db.json")) as tagmapf:
encoding="utf8") as tagmapf:
tagmap = json.load(tagmapf) tagmap = json.load(tagmapf)
for tag, num in tagmap.items(): for tag, num in tagmap.items():
cur.execute( cur.execute(
"INSERT INTO tags(id, tag) VALUES (%s, %s)", (num, tag)) "INSERT INTO tags(id, tag) VALUES (%s, %s)", (num, tag))
def _load_cats(self, cur): def _load_cats(self, cur):
with open(path.join(path.dirname(__file__), "catmap_db.json"), with open(path.join(path.dirname(__file__), "catmap_db.json")) as catmapf:
encoding="utf8") as catmapf:
catmap = json.load(catmapf) catmap = json.load(catmapf)
for cat_subcat, num in catmap.items(): for cat_subcat, num in catmap.items():
catsplit = cat_subcat.split(".", 1) catsplit = cat_subcat.split(".", 1)
...@@ -592,8 +590,7 @@ class PostgreSQL: ...@@ -592,8 +590,7 @@ class PostgreSQL:
conn = self.ppg.connect(user=self.user, password=self.password, conn = self.ppg.connect(user=self.user, password=self.password,
dbname=self.dbname, host='localhost') dbname=self.dbname, host='localhost')
cur = conn.cursor() cur = conn.cursor()
with open(path.join(path.dirname(__file__), 'warden_3.0_postgres.sql'), with open(path.join(path.dirname(__file__), 'warden_3.0_postgres.sql')) as script:
encoding="utf8") as script:
statements = script.read() statements = script.read()
cur.execute(statements) cur.execute(statements)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment