diff options
author | Nejc Habjan <nejc.habjan@siemens.com> | 2022-07-29 10:31:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-29 10:31:06 +0200 |
commit | 1b7cd31dc9a4a15623ac168eaa355422634e2876 (patch) | |
tree | e6cd9f4b7e85f8d3dae081a126dc47f9f0ed938e | |
parent | 7a53c6950bb7df90e2a3f4e6d0436cb5d06c3b46 (diff) | |
parent | 433dba02e0d4462ae84a73d8699fe7f3e07aa410 (diff) | |
download | gitlab-1b7cd31dc9a4a15623ac168eaa355422634e2876.tar.gz |
Merge pull request #2201 from python-gitlab/jlvillal/encoding_warning
chore: make code PEP597 compliant
-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) |