diff options
| -rw-r--r-- | gitlab/cli.py | 4 | ||||
| -rw-r--r-- | setup.py | 6 | ||||
| -rw-r--r-- | tests/functional/conftest.py | 4 | ||||
| -rw-r--r-- | tests/unit/objects/test_todos.py | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/gitlab/cli.py b/gitlab/cli.py index b9a7574..c4af4b8 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -257,8 +257,8 @@ def _parse_value(v: Any) -> Any: # If the user-provided value starts with @, we try to read the file # path provided after @ as the real value. Exit on any error. try: - with open(v[1:]) as fl: - return fl.read() + with open(v[1:]) as f: + return f.read() except Exception as e: sys.stderr.write(f"{e}\n") sys.exit(1) @@ -6,7 +6,7 @@ from setuptools import find_packages, setup def get_version() -> str: version = "" - with open("gitlab/_version.py") as f: + with open("gitlab/_version.py", "r", encoding="utf-8") as f: for line in f: if line.startswith("__version__"): version = eval(line.split("=")[-1]) @@ -14,8 +14,8 @@ def get_version() -> str: return version -with open("README.rst", "r") as readme_file: - readme = readme_file.read() +with open("README.rst", "r", encoding="utf-8") as f: + readme = f.read() setup( name="python-gitlab", diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index e788646..d34c87e 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -87,7 +87,7 @@ def set_token(container, fixture_dir): logging.info("Creating API token.") set_token_rb = fixture_dir / "set_token.rb" - with open(set_token_rb, "r") as f: + with open(set_token_rb, "r", encoding="utf-8") as f: set_token_command = f.read().strip() rails_command = [ @@ -206,7 +206,7 @@ url = http://{docker_ip}:{port} private_token = {token} api_version = 4""" - with open(config_file, "w") as f: + with open(config_file, "w", encoding="utf-8") as f: f.write(config) return config_file diff --git a/tests/unit/objects/test_todos.py b/tests/unit/objects/test_todos.py index ded6cf9..cee8d01 100644 --- a/tests/unit/objects/test_todos.py +++ b/tests/unit/objects/test_todos.py @@ -12,8 +12,8 @@ from gitlab.v4.objects import Todo @pytest.fixture() def json_content(fixture_dir): - with open(fixture_dir / "todo.json", "r") as json_file: - todo_content = json_file.read() + with open(fixture_dir / "todo.json", "r", encoding="utf-8") as f: + todo_content = f.read() return json.loads(todo_content) |
