Skip to content

Commit

Permalink
Merge pull request #419 from Start-Out/dev/fix/bump-versions-fix-tests
Browse files Browse the repository at this point in the history
PATCH: Bump pytest, typer and fix tests
  • Loading branch information
trentonyo authored Dec 15, 2024
2 parents abd7d2b + 78df36e commit 347b9a0
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 122 deletions.
233 changes: 124 additions & 109 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "todo-or-not"
version = "0.14.8"
version = "0.14.9"
description = "todoon integrates the TODOs in your codebase with your GitHub repository"
authors = ["TrentonYo <trentonyo@gmail.com>"]
license = "GPL-3.0-only"
Expand All @@ -12,7 +12,7 @@ documentation = "https://github.com/Start-Out/todo-or-not/wiki"

[tool.poetry.dependencies]
python = "^3.11"
typer = "^0.12.3"
typer = "^0.15.1"
typing-extensions = "^4.10.0"
tqdm = "^4.66.4"
ply = "^3.11"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_unable_to_collect_issues(self):
assert result is False

def test_bot_submitted_issues_collected(self):
assert self.bot_submitted_issues is False
assert self.bot_submitted_issues == []


class TestLiveIssueFeatures(unittest.TestCase):
Expand Down
11 changes: 6 additions & 5 deletions tests/test_todoon.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,17 @@ def test_singular_passages_in_summary(self):
("GITHUB_REF_NAME", "branch"),
("GITHUB_TRIGGERING_ACTOR", "trentonyo"),
]
self._environment_up("singular", env_variables=env, disable_debug=True)
# Debug is enabled so that additional issues are not created
self._environment_up("singular", env_variables=env, disable_debug=False)

td.todoon(print_mode=False, silent=True)
td.todoon(print_mode=False, silent=True, verbose=True)

# number of issues
assert os.environ["TODOON_ISSUES_GENERATED"] == "0"
assert os.environ["TODOON_ISSUES_GENERATED"] == "2"
# number of duplicate issues
assert os.environ["TODOON_DUPLICATE_ISSUES_AVOIDED"] == "1"
assert os.environ["TODOON_DUPLICATE_ISSUES_AVOIDED"] == "0"
# number of closed issues
assert os.environ["TODOON_DUPLICATE_CLOSED_ISSUES"] == "1"
assert os.environ["TODOON_DUPLICATE_CLOSED_ISSUES"] == "0"

self._environment_down()

Expand Down
1 change: 1 addition & 0 deletions todo_or_not/localize.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"error_no_env": "ERROR: Missing required environment variable",
"error_gh_issues_read_failed": "ERROR: todoon failed to read from GitHub issues",
"error_gh_issues_create_failed": "ERROR: todoon failed to create a new GitHub issue",
"error_subprocess_api_request_failed": "ERROR: In a subprocess, API request failed",
"error_todo_ignore_not_found": "ERROR: .todo-ignore NOT FOUND! use -i to copy another .ignore OR --force to run without a .todo-ignore (NOT RECOMMENDED)",
"error_todo_ignore_not_supported": f"ERROR: .todo-ignore uses unsupported encoding or doesn't exist! Supported encodings: {SUPPORTED_ENCODINGS_TODOIGNORE}",
"error_exceeded_maximum_issues": "ERROR: Exceeded maximum number of issues for this run, exiting now",
Expand Down
14 changes: 9 additions & 5 deletions todo_or_not/todo_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,24 @@ def get_bot_submitted_issues(
f"/repos/{owner}/{repo}/issues?creator=app%2Ftodo-or-not&state=all",
]

if not (util.get_is_debug() or _test):
# If in debug or test mode, return an empty list
if util.get_is_debug() or _test:
util.print_wrap(log_level=log_level, msg=str(query), file=sys.stdout)
return []
# Otherwise, run the query and parse the returned json
else:
try:
response = subprocess.check_output(query)
except subprocess.CalledProcessError as e:
util.print_wrap(log_level=log_level, msg=str(e), file=sys.stderr)
#TODO NEW Localization 'error_subprocess_api_request_failed' | "ERROR: In a subprocess, API request failed" #localization
msg = f"{loc('error_subprocess_api_request_failed')} {str(e)}"
util.print_wrap(log_level=log_level, msg=msg, file=sys.stderr)
return False

_str = response.decode("utf-8")
_str.replace('"', '\\"')

return json.loads(_str)
else:
util.print_wrap(log_level=log_level, msg=str(query), file=sys.stderr)
return False


def get_encoding(
Expand Down

0 comments on commit 347b9a0

Please sign in to comment.