coala / corobo

A bot to help newcomers onboard OS projects! It's awesome!
MIT License
66 stars 103 forks source link

LabHubTestCase: LabHub testing setup #608

Closed nvzard closed 6 years ago

nvzard commented 6 years ago

The role of LabHubTestCase is to do the setUp necessary for testing a plugin which depends on LabHub plugin. It adapts the tests for GitStats plugins to use the LabHubTestCase.

Closes https://github.com/coala/corobo/issues/607

nvzard commented 6 years ago

Yes it was possible to include LabHub also, but Ban is not dependent on labhub. It does not require LabHubTestBase.

TravisBuddy commented 6 years ago

Travis tests have failed

Hey @nvzard, Please read the following log in order to understand the failure reason. It'll be awesome if you fix what's wrong and commit the changes.

1st Build

python -m pytest ``` ============================= test session starts ============================== platform linux -- Python 3.6.3, pytest-3.6.4, py-1.5.2, pluggy-0.6.0 rootdir: /home/travis/build/coala/corobo, inifile: setup.cfg plugins: requests-mock-1.5.2, xdist-1.22.5, travis-fold-1.3.0, timeout-1.3.1, 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.5.1 collected 40 items tests/answer_test.py . [ 2%] tests/ban_test.py .. [ 7%] tests/coala_lowercase_c_test.py .. [ 12%] tests/coatils_test.py ........... [ 40%] tests/deprecate_bot_prefixes_test.py . [ 42%] tests/explain_test.py . [ 45%] tests/ghetto_test.py . [ 47%] tests/git_stats_test.py F [ 50%] tests/labhub_test.py ......... [ 72%] tests/lmgtfy_test.py . [ 75%] tests/nevermind_test.py . [ 77%] tests/pitchfork_test.py . [ 80%] tests/searchdocs_test.py . [ 82%] tests/ship_it_test.py . [ 85%] tests/spam_test.py .... [ 95%] tests/the_rules_test.py . [ 97%] tests/wolfram_alpha_test.py . [100%] =================================== FAILURES =================================== __________________________ TestGitStats.test_pr_list ___________________________ self = def setUp(self): > super().setUp(plugins.git_stats.GitStats) tests/git_stats_test.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = dependent_plugin = def setUp(self, dependent_plugin=None): plugins.labhub.github3 = create_autospec(github3) self.mock_org = create_autospec(github3.orgs.Organization) self.mock_gh = create_autospec(github3.GitHub) self.mock_team = create_autospec(github3.orgs.Team) self.mock_team.name = PropertyMock() self.mock_team.name = 'mocked team' self.teams = { 'coala newcomers': self.mock_team, 'coala developers': self.mock_team, 'coala maintainers': self.mock_team, } self.mock_repo = create_autospec(IGitt.GitHub.GitHub.GitHubRepository) plugins.labhub.github3.login.return_value = self.mock_gh self.mock_gh.organization.return_value = self.mock_org self.mock_org.teams.return_value = [self.mock_team] plugins.labhub.github3.organization.return_value = self.mock_org # patching plugins.labhub.GitHub = create_autospec(IGitt.GitHub.GitHub.GitHub) plugins.labhub.GitLab = create_autospec(IGitt.GitLab.GitLab.GitLab) plugins.labhub.GitHubToken = create_autospec(IGitt.GitHub.GitHubToken) plugins.labhub.GitLabPrivateToken = create_autospec( IGitt.GitLab.GitLabPrivateToken) if dependent_plugin: > super().setUp(plugins.labhub.LabHub, dependent_plugin,) E TypeError: setUp() takes 2 positional arguments but 3 were given tests/labhub_test_case.py:40: TypeError travis_fold:start:py-5514.cov.0 ----------- coverage: platform linux, python 3.6.3-final-0 ----------- Name Stmts Miss Cover Missing ----------------------------------------------------------------- plugins/__init__.py 0 0 100% plugins/answer.py 25 0 100% plugins/ban.py 37 0 100% plugins/coala_lowercase_c.py 12 0 100% plugins/coatils.py 116 0 100% plugins/constants.py 7 0 100% plugins/deprecate_bot_prefixes.py 6 0 100% plugins/explain.py 20 0 100% plugins/ghetto.py 10 0 100% plugins/git_stats.py 51 41 20% 25-77 plugins/labhub.py 236 0 100% plugins/lmgtfy.py 4 0 100% plugins/nevermind.py 5 0 100% plugins/pitchfork.py 12 0 100% plugins/searchdocs.py 16 0 100% plugins/ship_it.py 7 0 100% plugins/spam.py 13 0 100% plugins/the_rules.py 5 0 100% plugins/wolfram_alpha.py 18 0 100% ----------------------------------------------------------------- TOTAL 600 41 93% travis_fold:end:py-5514.cov.0 FAIL Required test coverage of 100% not reached. Total coverage: 93.17% =============================== warnings summary =============================== Module already imported so cannot be rewritten: errbot.backends.test tests/spam_test.py::TestBot cannot collect test class 'TestBot' because it has a __init__ constructor -- Docs: http://doc.pytest.org/en/latest/warnings.html ============== 1 failed, 39 passed, 2 warnings in 108.67 seconds =============== ```
gitmate-bot commented 6 years ago

Comment on f2fc7255dba2e56748d55d9a68d2773cea0855b5, file plugins/ship_it.py, line 17.

Broken link - unable to connect to http://www.zmescience.com/wp-content/uploads/2010/09/squirrel.jpg

Origin: InvalidLinkBear, Section: all.links.

jayvdb commented 6 years ago

ack https://github.com/coala/corobo/pull/608/commits/1eb78d17ef7a08809efffb3b6488061415fa2679

jayvdb commented 6 years ago

@gitmate-bot ff

gitmate-bot commented 6 years ago

Hey! I'm GitMate.io! This pull request is being fastforwarded automatically. Please DO NOT push while fastforward is in progress or your changes would be lost permanently :warning:

gitmate-bot commented 6 years ago

Automated fastforward with GitMate.io was successful! :tada: