Skip to content

Commit

Permalink
Test pull request
Browse files Browse the repository at this point in the history
Pull request used to test the action.
  • Loading branch information
AndreMiras committed Nov 29, 2020
1 parent bb2d6b0 commit 63cca1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 69 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ lint/flake8: virtualenv
lint/black: virtualenv
$(BLACK) --check $(SOURCES)

lint: lint/isort lint/flake8 lint/black
lint: # lint/isort lint/flake8 lint/black
echo pass

format/isort: virtualenv
$(ISORT) $(SOURCES)
Expand Down
68 changes: 0 additions & 68 deletions tests/test_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,74 +68,6 @@ def test_main_base_path(self):
mock.call("TOKEN", False, False, "SRC")
]

def test_main_parallel_finished(self):
argv = ["src/entrypoint.py", "--github-token", "TOKEN", "--parallel-finished"]
with patch_sys_argv(argv), mock.patch(
"entrypoint.post_webhook"
) as m_post_webhook:
entrypoint.main()
assert m_post_webhook.call_args_list == [mock.call("TOKEN")]

def test_try_main(self):
with mock.patch(
"entrypoint.main", side_effect=Exception
) as m_main, pytest.raises(SystemExit) as ex_info:
entrypoint.try_main()
assert m_main.call_args_list == [mock.call()]
assert ex_info.value.args == (entrypoint.ExitCode.FAILURE,)

def test_run_coveralls_github_token(self):
"""Simple case when Coveralls.wear() returns some results."""
url = "https://coveralls.io/jobs/1234"
with patch_coveralls_wear() as m_wear, patch_log() as m_log:
m_wear.return_value = {
"message": "Job ##12.34",
"url": url,
}
entrypoint.run_coveralls(repo_token="TOKEN")
assert m_wear.call_args_list == [mock.call()]
assert m_log.method_calls == [
mock.call.info("Trying submitting coverage with service_name: github..."),
mock.call.debug(
"Patching os.environ with: "
"{'COVERALLS_REPO_TOKEN': 'TOKEN', 'COVERALLS_PARALLEL': ''}"
),
mock.call.debug(m_wear.return_value),
mock.call.info(url),
]

def test_run_coveralls_wear_error_once(self):
"""On Coveralls.wear() error we should try another `service_name`."""
url = "https://coveralls.io/jobs/1234"
side_effect = (
CoverallsException("Error"),
{"message": "Job ##12.34", "url": url},
)
with patch_coveralls_wear() as m_wear, patch_log() as m_log:
m_wear.side_effect = side_effect
entrypoint.run_coveralls(repo_token="TOKEN")
assert m_wear.call_args_list == [mock.call(), mock.call()]
assert m_log.method_calls == [
mock.call.info("Trying submitting coverage with service_name: github..."),
mock.call.debug(
"Patching os.environ with: "
"{'COVERALLS_REPO_TOKEN': 'TOKEN', 'COVERALLS_PARALLEL': ''}"
),
mock.call.warning(
"Failed submitting coverage with service_name: github",
exc_info=side_effect[0],
),
mock.call.info(
"Trying submitting coverage with service_name: github-actions..."
),
mock.call.debug(
"Patching os.environ with: "
"{'COVERALLS_REPO_TOKEN': 'TOKEN', 'COVERALLS_PARALLEL': ''}"
),
mock.call.debug(side_effect[1]),
mock.call.info(url),
]

def test_run_coveralls_wear_error_twice(self):
"""Exits with error code if Coveralls.wear() fails twice."""
side_effect = (
Expand Down

0 comments on commit 63cca1f

Please sign in to comment.