-
-
Save abhishalya/169047377e595d1cfc6b1882f4e6130f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================================================================================================ test session starts ============================================================================================================= | |
platform linux -- Python 3.6.6, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 | |
rootdir: /home/abhishalya/coala_developement/corobo, inifile: setup.cfg | |
plugins: requests-mock-1.5.2, xdist-1.24.0, travis-fold-1.3.0, timeout-1.3.2, reqs-0.0.7, reorder-0.1.1, profiling-1.3.0, mock-1.10.0, instafail-0.3.0, forked-0.2, error-for-skips-1.0.0, env-0.6.2, cov-2.6.0 | |
collected 44 items | |
tests/answer_test.py ... [ 6%] | |
tests/ban_test.py .. [ 11%] | |
tests/coala_lowercase_c_test.py .. [ 15%] | |
tests/coatils_test.py ........... [ 40%] | |
tests/deprecate_bot_prefixes_test.py . [ 43%] | |
tests/explain_test.py . [ 45%] | |
tests/ghetto_test.py . [ 47%] | |
tests/git_stats_test.py . [ 50%] | |
tests/labhub_test.py .F | |
_________________________________________________________________________________________________________ TestLabHub.test_assign_cmd _________________________________________________________________________________________________________ | |
self = <tests.labhub_test.TestLabHub testMethod=test_assign_cmd> | |
def test_assign_cmd(self): | |
mock_issue = create_autospec(GitHubIssue) | |
self.mock_repo.get_issue.return_value = mock_issue | |
mock_dev_team = create_autospec(github3.orgs.Team) | |
mock_maint_team = create_autospec(github3.orgs.Team) | |
mock_dev_team.is_member.return_value = False | |
mock_maint_team.is_member.return_value = False | |
self.teams['coala developers'] = mock_dev_team | |
self.teams['coala maintainers'] = mock_maint_team | |
mock_dict = { | |
'REPOS': {'a': self.mock_repo}, | |
'TEAMS': self.teams, | |
} | |
self.inject_mocks('LabHub', mock_dict) | |
testbot = self | |
cmd = '!assign https://github.com/{}/{}/issues/{}' | |
# no assignee, not newcomer | |
mock_issue.assignees = tuple() | |
self.mock_team.is_member.return_value = False | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'You need to be a member of this organization ' | |
'to use this command.') | |
# no assignee, newcomer, initiatives/gci | |
self.mock_team.is_member.return_value = True | |
mock_maint_team.is_member.return_value = False | |
mock_dev_team.is_member.return_value = False | |
mock_issue.labels = 'initiatives/gci', | |
mock_issue.assignees = tuple() | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'You are not eligible to be assigned' | |
' to this issue') | |
testbot.pop_message() | |
# no assignee, developer, initiatives/gci | |
mock_maint_team.is_member.return_value = False | |
mock_dev_team.is_member.return_value = True | |
mock_issue.labels = 'initiatives/gci', | |
mock_issue.assignees = tuple() | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'You are not eligible to be assigned' | |
' to this issue') | |
testbot.pop_message() | |
mock_dev_team.is_member.return_value = False | |
# no assignee, newcomer, difficulty/low | |
mock_issue.labels = PropertyMock() | |
mock_issue.labels = ('difficulty/low', ) | |
mock_issue.assignees = tuple() | |
self.mock_team.is_member.return_value = True | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'You\'ve been assigned to the issue') | |
# no assignee, newcomer, no labels | |
self.mock_team.is_member.return_value = True | |
mock_issue.labels = tuple() | |
mock_issue.assignees = tuple() | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'not eligible to be assigned to this issue') | |
testbot.pop_message() | |
# no assignee, newcomer, difficulty medium | |
mock_issue.labels = ('difficulty/medium', ) | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'not eligible to be assigned to this issue') | |
testbot.pop_message() | |
# no assignee, newcomer, difficulty medium | |
mock_dict = { | |
'TEAMS': { | |
'not-coala newcomers': self.mock_team, | |
'not-coala developers': mock_dev_team, | |
'not-coala maintainers': mock_maint_team, | |
}, | |
} | |
self.inject_mocks('LabHub', mock_dict) | |
self.labhub.config['GH_ORG_NAME'] = 'not-coala' | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'assigned') | |
self.labhub.config['GH_ORG_NAME'] = 'coala' | |
mock_dict['TEAMS'] = self.teams | |
self.inject_mocks('LabHub', mock_dict) | |
# newcomer, developer, difficulty/medium | |
mock_dev_team.is_member.return_value = True | |
mock_maint_team.is_member.return_value = False | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'assigned') | |
# has assignee | |
mock_issue.assignees = ('somebody', ) | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
'already assigned to someone') | |
# has assignee same as user | |
mock_issue.assignees = (None, ) | |
testbot.assertCommand(cmd.format('coala', 'a', '23'), | |
> 'already assigned to you') | |
tests/labhub_test.py:348: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <tests.labhub_test.TestLabHub testMethod=test_assign_cmd>, command = '!assign https://github.com/coala/a/issues/23', response = 'already assigned to you', timeout = 5 | |
def assertCommand(self, command, response, timeout=5): | |
"""Assert the given command returns the given response""" | |
self.bot.push_message(command) | |
msg = self.bot.pop_message(timeout) | |
> assert response in msg, f'{response} not in {msg}.' | |
E AssertionError: already assigned to you not in The issue is already assigned to someone. Please check if the assignee is still working on the issue, if not, you should ask for reassignment.. | |
../environments/coroboenv/lib/python3.6/site-packages/errbot/backends/test.py:457: AssertionError | |
------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------ | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
tests/labhub_test.py F | |
______________________________________________________________________________________________________ TestLabHub.test_create_issue_cmd ______________________________________________________________________________________________________ | |
self = <tests.labhub_test.TestLabHub testMethod=test_create_issue_cmd> | |
def test_create_issue_cmd(self): | |
plugins.labhub.GitHubToken.assert_called_with(None) | |
plugins.labhub.GitLabPrivateToken.assert_called_with(None) | |
# Start ignoring PycodestyleBear, LineLengthBear | |
# TODO | |
# Ignoring assertion to prevent build failure for time being | |
# Creating issue in private chat | |
# testbot_private.assertCommand('!new issue repository this is the title\nbo\ndy', | |
# 'You\'re not allowed') | |
# Stop ignoring | |
# Creating issue in public chat | |
self.mock_team.is_member.return_value = True | |
testbot_public = self | |
testbot_public.assertCommand( | |
textwrap.dedent('''\ | |
!new issue repository this is the title | |
first line of body | |
second line of body | |
'''), | |
'Here you go') | |
self.global_mocks['REPOS']['repository'].create_issue \ | |
.assert_called_once_with( | |
'this is the title', | |
textwrap.dedent('''\ | |
first line of body | |
second line of body | |
> Opened by @None at [text]()''') | |
) | |
E AssertionError: Expected call: create_issue('this is the title', 'first line of body\nsecond line of body\nOpened by @None at [text]()') | |
E Actual call: create_issue('this is the title', 'first line of body\nsecond line of body\nOpened by @batman at [text]()') | |
E | |
E pytest introspection follows: | |
E | |
E Args: | |
E assert ('this is the... at [text]()') == ('this is the ... at [text]()') | |
E At index 1 diff: 'first line of body\nsecond line of body\nOpened by @batman at [text]()' != 'first line of body\nsecond line of body\nOpened by @None at [text]()' | |
E Use -v to get the full diff | |
tests/labhub_test.py:167: AssertionError | |
------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------ | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
tests/labhub_test.py ......F | |
________________________________________________________________________________________________________ TestLabHub.test_unassign_cmd ________________________________________________________________________________________________________ | |
self = <tests.labhub_test.TestLabHub testMethod=test_unassign_cmd> | |
def test_unassign_cmd(self): | |
self.inject_mocks('LabHub', {'REPOS': {'example': self.mock_repo}}) | |
mock_iss = create_autospec(IGitt.GitHub.GitHubIssue) | |
self.mock_repo.get_issue.return_value = mock_iss | |
mock_iss.assignees = PropertyMock() | |
mock_iss.assignees = (None, ) | |
mock_iss.unassign = MagicMock() | |
self.mock_team.is_member.return_value = True | |
testbot = self | |
testbot.assertCommand( | |
'!unassign https://github.com/coala/example/issues/999', | |
'you are unassigned now', | |
> timeout=10000) | |
tests/labhub_test.py:220: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <tests.labhub_test.TestLabHub testMethod=test_unassign_cmd>, command = '!unassign https://github.com/coala/example/issues/999', response = 'you are unassigned now', timeout = 10000 | |
def assertCommand(self, command, response, timeout=5): | |
"""Assert the given command returns the given response""" | |
self.bot.push_message(command) | |
msg = self.bot.pop_message(timeout) | |
> assert response in msg, f'{response} not in {msg}.' | |
E AssertionError: you are unassigned now not in You are not an assignee on the issue.. | |
../environments/coroboenv/lib/python3.6/site-packages/errbot/backends/test.py:457: AssertionError | |
------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------ | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
waiting on queue | |
message received | |
tests/labhub_test.py . [ 75%] | |
tests/lmgtfy_test.py . [ 77%] | |
tests/nevermind_test.py . [ 79%] | |
tests/pitchfork_test.py . [ 81%] | |
tests/searchdocs_test.py . [ 84%] | |
tests/ship_it_test.py . [ 86%] | |
tests/spam_test.py .... [ 95%] | |
tests/the_rules_test.py . [ 97%] | |
tests/wolfram_alpha_test.py . [100%] | |
Profiling (from /home/abhishalya/coala_developement/corobo/prof/combined.prof): | |
Tue Nov 6 14:22:24 2018 /home/abhishalya/coala_developement/corobo/prof/combined.prof | |
9370962 function calls (8747201 primitive calls) in 149.098 seconds | |
Ordered by: cumulative time | |
List reduced from 2296 to 20 due to restriction <20> | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
44 0.000 0.000 149.086 3.388 runner.py:105(pytest_runtest_call) | |
44 0.000 0.000 149.085 3.388 unittest.py:182(runtest) | |
44 0.000 0.000 149.084 3.388 case.py:652(__call__) | |
44 0.003 0.000 149.084 3.388 case.py:570(run) | |
1 0.000 0.000 122.050 122.050 labhub_test.py:435(test_alive) | |
333/188 0.160 0.000 94.995 0.505 mock.py:2120(create_autospec) | |
8687 0.066 0.000 75.373 0.009 mock.py:1828(__init__) | |
1 0.000 0.000 70.874 70.874 labhub_test.py:446(<dictcomp>) | |
17374 25.095 0.001 53.234 0.003 mock.py:1834(_mock_set_magics) | |
5220 49.772 0.010 49.772 0.010 {method 'acquire' of '_thread.lock' objects} | |
1170 0.009 0.000 49.211 0.042 threading.py:263(wait) | |
203 0.001 0.000 49.072 0.242 test.py:307(pop_message) | |
251 0.004 0.000 49.072 0.196 queue.py:147(get) | |
114 0.001 0.000 43.196 0.379 test.py:453(assertCommand) | |
1120730/560373 0.680 0.000 27.380 0.000 {built-in method builtins.delattr} | |
560357 26.700 0.000 27.095 0.000 mock.py:715(__delattr__) | |
17267 1.393 0.000 24.719 0.001 mock.py:63(_get_signature_object) | |
17210 0.023 0.000 23.319 0.001 inspect.py:3050(signature) | |
17210 0.034 0.000 23.296 0.001 inspect.py:2798(from_callable) | |
32578/17210 1.336 0.000 23.263 0.001 inspect.py:2176(_signature_from_callable) | |
----------- coverage: platform linux, python 3.6.6-final-0 ----------- | |
Name Stmts Miss Branch BrPart Cover Missing | |
------------------------------------------------------------------------------- | |
answers/__init__.py 0 0 0 0 100% | |
plugins/__init__.py 0 0 0 0 100% | |
plugins/answer.py 31 0 8 0 100% | |
plugins/coala_lowercase_c.py 12 0 4 0 100% | |
plugins/coatils.py 115 0 67 0 100% | |
plugins/constants.py 5 0 0 0 100% | |
plugins/deprecate_bot_prefixes.py 6 0 4 0 100% | |
plugins/explain.py 20 0 6 0 100% | |
plugins/ghetto.py 10 0 2 0 100% | |
plugins/git_stats.py 51 0 19 0 100% | |
plugins/lmgtfy.py 4 0 0 0 100% | |
plugins/nevermind.py 5 0 0 0 100% | |
plugins/pitchfork.py 12 0 2 0 100% | |
plugins/searchdocs.py 14 0 2 0 100% | |
plugins/ship_it.py 7 0 0 0 100% | |
plugins/spam.py 13 0 2 0 100% | |
plugins/the_rules.py 5 0 0 0 100% | |
plugins/wolfram_alpha.py 19 0 6 0 100% | |
utils/__init__.py 0 0 0 0 100% | |
utils/backends.py 0 0 0 0 100% | |
utils/mixin.py 20 0 6 0 100% | |
------------------------------------------------------------------------------- | |
TOTAL 349 0 128 0 100% | |
Required test coverage of 100% reached. Total coverage: 100.00% | |
========================================================================================================== short test summary info =========================================================================================================== | |
FAIL tests/labhub_test.py::TestLabHub::test_assign_cmd | |
FAIL tests/labhub_test.py::TestLabHub::test_create_issue_cmd | |
FAIL tests/labhub_test.py::TestLabHub::test_unassign_cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment