]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
ci: fix pylint issues
authorTomas Krizek <tomas.krizek@nic.cz>
Wed, 27 Oct 2021 11:29:11 +0000 (13:29 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Wed, 27 Oct 2021 11:37:55 +0000 (13:37 +0200)
tests/pytests/kresd.py
tests/pytests/proxy.py
tests/pytests/pylintrc

index 7eeceb68a9e09add7473474ca8d0a5a282cacc86..e0c216ac924ece37dbe1f757eb69be64444e7662 100644 (file)
@@ -40,7 +40,7 @@ def create_file_from_template(template_path, dest, data):
     template = env.get_template(template_path)
     rendered_template = template.render(**data)
 
-    with open(dest, "w") as fh:
+    with open(dest, "w", encoding='UTF-8') as fh:
         fh.write(rendered_template)
 
 
@@ -92,7 +92,7 @@ class Kresd(ContextDecorator):
             self.tls_port = make_port(self.ip, self.ip6)
 
         create_file_from_template(KRESD_CONF_TEMPLATE, self.config_path, {'kresd': self})
-        self.logfile = open(self.logfile_path, 'w')
+        self.logfile = open(self.logfile_path, 'w', encoding='UTF-8')
         self.process = subprocess.Popen(
             ['kresd', '-c', self.config_path, '-n', self.workdir],
             stderr=self.logfile, env=os.environ.copy())
@@ -112,7 +112,7 @@ class Kresd(ContextDecorator):
                 raise RuntimeError("Kresd crashed with returncode: {}".format(
                     self.process.returncode))
         except (RuntimeError, ConnectionError):  # pylint: disable=try-except-raise
-            with open(self.logfile_path) as log:  # print log for debugging
+            with open(self.logfile_path, encoding='UTF-8') as log:  # print log for debugging
                 print(log.read())
             raise
 
@@ -221,7 +221,7 @@ class Kresd(ContextDecorator):
 
     def partial_log(self):
         partial_log = '\n (... ommiting log start)\n'
-        with open(self.logfile_path) as log:  # display partial log for debugging
+        with open(self.logfile_path, encoding='UTF-8') as log:  # display partial log for debugging
             past_startup_msgid = False
             past_startup = False
             for line in log:
index a55542bb457c0f56c1d7d98a6c9bb36da4b2c63f..b8a53cd8051f1c1192cce9d5d14bd0ab07c57f5f 100644 (file)
@@ -135,9 +135,9 @@ def kresd_tls_client(
     assert proxy.upstream_ip in ALLOWED_IPS, "only localhost IPs are supported for proxy"
 
     if kresd_tls_client_kwargs is None:
-        kresd_tls_client_kwargs = dict()
+        kresd_tls_client_kwargs = {}
     if kresd_fwd_target_kwargs is None:
-        kresd_fwd_target_kwargs = dict()
+        kresd_fwd_target_kwargs = {}
 
     # run forward target instance
     dir1 = os.path.join(workdir, 'kresd_fwd_target')
index a667afb023e806b1305d1e5539f703a419a4ebb9..2c406be20d7b2b8ae0504abc9f7213f48175fa78 100644 (file)
@@ -16,6 +16,7 @@ disable=
     no-else-return,
     redefined-outer-name,  # commonly used with pytest fixtures
     consider-using-with,
+    consider-using-f-string,
 
 
 [SIMILARITIES]