From 2b70a7b495488a5fc603b0e222f98c31abbb993c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Malo=C5=A1t=C3=ADk?= <malostik@cesnet.cz> Date: Mon, 21 Nov 2022 13:27:23 +0100 Subject: [PATCH] Fix Python2 compatibility of test_warden_server --- warden_server/test_warden_server.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/warden_server/test_warden_server.py b/warden_server/test_warden_server.py index 2efe5b5..fddf0a0 100755 --- a/warden_server/test_warden_server.py +++ b/warden_server/test_warden_server.py @@ -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) -- GitLab