diff options
author | John L. Villalovos <john@sodarock.com> | 2022-07-28 22:11:19 -0700 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2022-07-28 22:11:19 -0700 |
commit | 433dba02e0d4462ae84a73d8699fe7f3e07aa410 (patch) | |
tree | 19710dd778df00643c8bf214c1a6f0bfad7522be | |
parent | 8ba97aa459420ec5ae824d9299d6564656841559 (diff) | |
download | gitlab-433dba02e0d4462ae84a73d8699fe7f3e07aa410.tar.gz |
chore: make code PEP597 compliant
Use `encoding="utf-8"` in `open()` and open-like functions.
https://peps.python.org/pep-0597/
-rw-r--r-- | gitlab/config.py | 2 | ||||
-rw-r--r-- | tests/meta/test_v4_objects_imported.py | 2 | ||||
-rw-r--r-- | tests/unit/objects/test_packages.py | 2 | ||||
-rw-r--r-- | tests/unit/test_config.py | 3 |
4 files changed, 5 insertions, 4 deletions
diff --git a/gitlab/config.py b/gitlab/config.py index dc577fc..152ec7e 100644 --- a/gitlab/config.py +++ b/gitlab/config.py @@ -135,7 +135,7 @@ class GitlabConfigParser: def _parse_config(self) -> None: _config = configparser.ConfigParser() - _config.read(self._files) + _config.read(self._files, encoding="utf-8") if self.gitlab_id and not _config.has_section(self.gitlab_id): raise GitlabDataError( diff --git a/tests/meta/test_v4_objects_imported.py b/tests/meta/test_v4_objects_imported.py index 083443a..f158a33 100644 --- a/tests/meta/test_v4_objects_imported.py +++ b/tests/meta/test_v4_objects_imported.py @@ -13,7 +13,7 @@ def test_verify_v4_objects_imported() -> None: assert len(gitlab.v4.objects.__path__) == 1 init_files: Set[str] = set() - with open(gitlab.v4.objects.__file__, "r") as in_file: + with open(gitlab.v4.objects.__file__, "r", encoding="utf-8") as in_file: for line in in_file.readlines(): if line.startswith("from ."): init_files.add(line.rstrip()) diff --git a/tests/unit/objects/test_packages.py b/tests/unit/objects/test_packages.py index 79f1d1b..cee3fa8 100644 --- a/tests/unit/objects/test_packages.py +++ b/tests/unit/objects/test_packages.py @@ -276,7 +276,7 @@ def test_delete_project_package_file_from_package_file_object( def test_upload_generic_package(tmp_path, project, resp_upload_generic_package): path = tmp_path / file_name - path.write_text(file_content) + path.write_text(file_content, encoding="utf-8") package = project.generic_packages.upload( package_name=package_name, package_version=package_version, diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index c4fcbef..0e3324a 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -290,7 +290,8 @@ def test_data_from_helper(m_open, monkeypatch, tmp_path): #!/bin/sh echo "secret" """ - ) + ), + encoding="utf-8", ) helper.chmod(0o755) |