test: test cases by ideepu · Pull Request #14 · ideepu/python-coverage-comment · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,5 @@ For example, if your project has a run.py file, you can run it using the followi

That's it! You have successfully set up your local environment using Pipenv.

This project is inspired by the concepts of [py-cov-action/python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action.git).
This project is almost copy of [py-cov-action/python-coverage-comment-action]
(<https://github.com/py-cov-action/python-coverage-comment-action.git>) with few modifications.
4 changes: 2 additions & 2 deletions codecov/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from codecov import github_client, groups, log, settings

GITHUB_ACTIONS_LOGIN = 'CI-codecov[bot]'
GITHUB_CODECOV_LOGIN = 'CI-codecov[bot]'


class CannotDeterminePR(Exception):
Expand Down Expand Up @@ -83,7 +83,7 @@ def get_my_login(github: github_client.GitHub) -> str:
# The GitHub actions user cannot access its own details
# and I'm not sure there's a way to see that we're using
# the GitHub actions user except noting that it fails
return GITHUB_ACTIONS_LOGIN
return GITHUB_CODECOV_LOGIN

return response.login

Expand Down
6 changes: 2 additions & 4 deletions codecov/github_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations

Expand All @@ -9,7 +8,7 @@


class _Executable:
def __init__(self, _gh, _method, _path):
def __init__(self, _gh: GitHub, _method: str, _path: str):
self._gh = _gh
self._method = _method
self._path = _path
Expand Down Expand Up @@ -37,7 +36,6 @@ def __getattr__(self, attr):


class GitHub:

"""
GitHub client.
"""
Expand All @@ -48,7 +46,7 @@ def __init__(self, session: httpx.Client):
def __getattr__(self, attr):
return _Callable(self, f'/{attr}')

def _http(self, method, path, *, use_bytes=False, use_text=False, **kw):
def _http(self, method: str, path: str, *, use_bytes: bool = False, use_text: bool = False, **kw):
_method = method.lower()
requests_kwargs = {}
headers = kw.pop('headers', {})
Expand Down
17 changes: 7 additions & 10 deletions codecov/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ class InvalidAnnotationType(Exception):


def path_below(path_str: str | pathlib.Path) -> pathlib.Path:
try:
path = pathlib.Path(path_str).resolve()
if not (path.exists() and path.is_file()):
raise ValueError('Path does not exist')

if path.suffix != '.json':
raise ValueError('The file is not a JSON file.')
return path
except ValueError as exc:
raise ValueError('Path can not be resolved') from exc
path = pathlib.Path(path_str).resolve()
if not (path.exists() and path.is_file()):
raise ValueError('Path does not exist')

if path.suffix != '.json':
raise ValueError('The file is not a JSON file.')
return path


def str_to_bool(value: str) -> bool:
Expand Down
35 changes: 4 additions & 31 deletions codecov/template.py
Loading