Skip to content

Commit 1b7cd31

Browse files
authored
Merge pull request #2201 from python-gitlab/jlvillal/encoding_warning
chore: make code PEP597 compliant
2 parents 7a53c69 + 433dba0 commit 1b7cd31

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

gitlab/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def __init__(
135135

136136
def _parse_config(self) -> None:
137137
_config = configparser.ConfigParser()
138-
_config.read(self._files)
138+
_config.read(self._files, encoding="utf-8")
139139

140140
if self.gitlab_id and not _config.has_section(self.gitlab_id):
141141
raise GitlabDataError(

tests/meta/test_v4_objects_imported.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_verify_v4_objects_imported() -> None:
1313
assert len(gitlab.v4.objects.__path__) == 1
1414

1515
init_files: Set[str] = set()
16-
with open(gitlab.v4.objects.__file__, "r") as in_file:
16+
with open(gitlab.v4.objects.__file__, "r", encoding="utf-8") as in_file:
1717
for line in in_file.readlines():
1818
if line.startswith("from ."):
1919
init_files.add(line.rstrip())

tests/unit/objects/test_packages.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def test_delete_project_package_file_from_package_file_object(
276276

277277
def test_upload_generic_package(tmp_path, project, resp_upload_generic_package):
278278
path = tmp_path / file_name
279-
path.write_text(file_content)
279+
path.write_text(file_content, encoding="utf-8")
280280
package = project.generic_packages.upload(
281281
package_name=package_name,
282282
package_version=package_version,

tests/unit/test_config.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ def test_data_from_helper(m_open, monkeypatch, tmp_path):
290290
#!/bin/sh
291291
echo "secret"
292292
"""
293-
)
293+
),
294+
encoding="utf-8",
294295
)
295296
helper.chmod(0o755)
296297

0 commit comments

Comments
 (0)