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