Commit Graph
1811 Commits
Author SHA1 Message Date
Chris de Graaf edcbdfdaf9 Add create_repository_dispatch (#1449) 2020-04-26 09:59:34 +08:00
ton-katsu 3ab97d6145 Add some attributes. (#1468)
* Add some attributes to Repository and Organization

* Format.

* small fix

* Add some test.
2020-04-21 11:49:32 +10:00
Steve Kowalik 7046259832 Drop documentation for len() of PaginatedList (#1470)
PaginatedList does not support len(), so stop mentioning it in the
docstring.

Fixes #1462
2020-04-18 14:55:07 +10:00
chloe jungah kim bafc4efc76 fix param name of projectcard's move function (#1451)
* fix param name of projectcard's move function

* fix test failure
2020-04-16 21:38:19 +10:00
Steve Kowalik 83bef0f7b2 Correct typos found with codespell (#1467)
Correct misspellings and typos located using the codespell tool. Add
codespell to pre-commit to avoid further regressions.

Fixes #1459
2020-04-16 13:25:01 +10:00
Steve Kowalik 0ebdbb2675 Export IncompletableObject in the github namespace (#1450)
When IncompletableObject was added, it was only added to
GithubException, and not imported directly into the github namespace
like other exceptions. Correct that, and clean up the resultant now
unrequired import.
2020-04-15 10:52:13 +10:00
Steve KowalikandChristian Clauss f1401c1550 Add GitHub Action workflow for checks (#1464)
To integrate better with the GitHub workflow, add a workflow for
checking pushes and PRs. This doesn't remove the Travis configuration,
which is still required for releases.

Co-Authored-By: Christian Clauss <cclauss@me.com>
2020-04-15 10:48:18 +10:00
Steve Kowalik b4ca917726 Drop unneeded ignore rule for flake8 (#1454)
We no longer have code or comments that triggers E203 (no space before
:), so we can drop it.
2020-04-11 18:25:06 +10:00
Steve Kowalik 393bd21bd1 Add missing mypy stubs (#1443)
Deployment, TimelineEvent{,Source} were missing mypy stubs, since they
were added after the mypy branch was started. Add them, and clean up two
spurious __future__ imports that are no longer required. Add mypy's
cache directory to .gitignore
2020-03-28 21:45:04 +11:00
Liuyang Wan af6cab5520 Reuse pre-commit checks in CI (#1442)
* Use pre-commit checks in CI

* Fix all issues flagged by mypy

* Update travis.yml to reflect testenv changes

* Update docs to use tox lint
2020-03-23 08:45:54 +08:00
Alice GIRARDandLiuyang Wan 91433fe925 Type stubs for mypy (#1231)
* First attempt at stubs

* fix AuthenticatedUser.piy

* fix PullRequest.piy

* fix Authorization.piy

* fix Branch.piy

* fix Clones.piy

* fix Commit.piy

* fix CommitCombinedStatus.piy

* fix CommitComment.piy

* fix CommitStatus.piy

* fix ContentFile.piy

* fix Download.piy

* fix Event.piy

* fix File.piy

* fix Gist.piy

* fix GistComment.piy

* fix GistFile.piy

* fix GitAuthor.piy

* fix GitBlob.piy

* fix GitCommit.piy

* fix GitRef.piy

* fix GitRelease.piy

* renamed stubs into pyi files

* fix Notification

* fix Repository

* fix GitReleaseAsset

* fix GitTag

* fix GitTree

* fix GitTreeElement

* fix GithubException

* fix GithubObject

* fix GitignoreTemplate

* fix HookDescription

* fix HookResponse

* fix InputGitAuthor

* fix Installation

* fix InstallationAuthorization

* fix Invitation

* fix Issue

* fix IssueComment

* Fix random issues found while testing

* fix IssuePullRequest

* fix Label

* fix License

* fix Migration

* fix Milestone

* fix NamedUser

* fix NotificationSubject

* fix Organization

* fix PaginatedList

* fix Path

* fix Permissions

* fix Plan

* fix Project

* fix ProjectCard

* fix ProjectColumn

* fix PullRequestComment

* fix PullRequestMergeStatus

* fix PullRequestPart

* fix PullRequestReview

* fix Rate

* fix RateLimit

* fix Reaction

* fix Referrer

* fix RepositoryKey

* fix RequiredPullRequestReviews

* fix RequiredStatusChecks

* fix SourceImport

* fix Stargazer

* fix StatsCodeFrequency

* fix StatsCommitActivity

* fix StatsContributor

* fix Tag

* fix Team

* fix Topic

* fix UserKey

* fix MainClass

* fix Requester

* added stubs for View

* added stubs for Membership

* various syntax errors

* silence mypy noise

* keeping track of recent changes

* black + isort

Co-authored-by: Liuyang Wan <lwan@zendesk.com>
2020-03-22 19:33:23 +08:00
Steve Kowalik 1440297699 Split up Repository.testStatistics (#1440)
The testStatistics testcase takes over ten seconds to run on my laptop,
and it does an awful lot of work. Split up the disparate parts into
seperate testcases.
2020-03-20 18:41:40 +11:00
Michał Górny d2e9bd69dd Use pytest to parametrize tests (#1438)
* Use pytest to parametrize tests

Use built-in pytest test case parametrization support over external
'parameterize' package.  The latter is not well maintained, and has
known Python 3.8 failures unsolved since November 2019.

Since pytest fixtures are incompatible with unittest-style tests,
rewrite the relevant test case to use pytest-style asserts.  This also
makes the resulting code simpler, as we no longer have to pass TestCase
to the helper classes.

* Refactor input cleaning in ReplayingConnection.__readNextRequest()
2020-03-18 18:44:40 +11:00
Liuyang Wan 7986ab51a2 Merge pull request #1437 from ahhda/create_org_project
Add support to create an organization project
2020-03-17 07:43:53 +08:00
Anuj Bansal 801ea38551 Add create project method and tests 2020-03-15 22:12:44 +05:30
Steve Kowalik afb1259a4e Publish version 1.47 2020-03-15 13:01:20 +11:00
Anuj Bansal f11f739505 Add support to edit and delete a project (#1434)
* Add methods to edit and delete a project

* Update tests for edit project
2020-03-15 12:57:12 +11:00
Steve Kowalik d20fd71ca8 Add myself to funding and maintainers (#1435)
I think the time is right is add myself to these two files!
2020-03-13 21:10:29 +11:00
Danilo Martins 0c55381b38 Add method for fetching pull requests associated with a commit (#1433)
* Add method for fetching pull requests associated with a commit

* Reference PR number instead of id on commit.get_pulls 

Fixes #1414
2020-03-13 11:07:19 +11:00
Adrian Bridgett 219bde53d3 Add "get_repo_permission" to Team class (#1416)
* Add "get_repo_permission" to Team class

* second attempt:
- accept repo name or repo object
- return github.Permissions.Permissions object
- try and following CONTRIBUTING.md better

* add missing import to tests
patch replay data with permission data

* assert a specific permission rather than just the type

Fixes #1415
2020-03-13 11:01:16 +11:00
Anuj Bansal e44d11d565 Add list projects support, update tests (#1431) 2020-03-11 12:40:25 +11:00
Steve Kowalik b1c35499f4 Don't transform completely in PullRequest.*assignees (#1428)
The two methods PullRequest.add_to_assignees() and
PullRequest.remove_from_assignees() are special, in that they call
POST/DELETE on the issue_url of the pull request, and then transform all
their attributes based on what was returned. This has a number of
effects, none of them any good for calling new methods on the same pull
request object. Instead, only pull out the changed attribute and use
that. Also change the returned URL for the POST call in the replay data
to match what GitHub returns.

Fixes #1406
2020-03-10 12:39:23 +11:00
Anuj Bansal bf62f75224 Add create_project support, add tests (#1429)
Add AuthenicatedUser.create_project()
2020-03-10 12:34:57 +11:00
Wan Liuyang 71dad3efa5 Merge pull request #1427 from ahhda/list_draft_pull_request
Add draft attribute to PullRequest
2020-03-09 15:04:30 +08:00
MarcoFalke bd28524853 Add draft attribute, update test 2020-03-09 12:20:12 +05:30
Steve Kowalik bfeacded4e Docstring for Repository.create_git_tag_and_release (#1425)
The function create_git_tag_and_release had no docstring, so it didn't
appear anywhere in our docs. Add a short one linking to the two methods
it calls.

Fixes #1402
2020-03-09 10:56:31 +11:00
Steve Kowalik b30c09aaa4 Create a tox docs environment (#1426)
To make it easier to build documentation locally, add a new tox
environment that installs our requirements and runs Sphinx.
2020-03-08 16:36:52 +11:00
Steve Kowalik 3d93ee1ce5 Add Deployments API (#1424)
Add a new class, Deployment to describe a deployment performed utilising
GitHub. Add three methods onto Repository to list them and create them.

Fixes #1117
2020-03-08 16:27:59 +11:00
Jody McIntyre 425280cee7 Add support for editing project cards (#1418)
* Add edit() to ProjectCard

* Add unit tests of ProjectCard.edit
2020-03-08 14:24:35 +11:00
Wan Liuyang 96494965ee Merge pull request #1422 from ahhda/draft_pull_request
Add support for draft pull request
2020-03-07 14:27:25 +08:00
Anuj Bansal bd0211eb73 Add draft flag parameter, update tests 2020-03-07 11:42:41 +05:30
Steve Kowalik c822dd1ce0 Switch to using pytest (#1423)
Due to the recent deprecation of setup.py test, we should move with the
times, and switch to a non-deprecated test runner.

Add configuration for pytest, and switch tox to using it. Remove
AllTests, since it is no longer required to locate test classes, and
rewrite tests/__main__.py as a pytest conftest plugin.

Also drop the test function from manage.sh, tox does a much better job.
2020-03-07 12:43:49 +11:00
Steve Kowalik f2939eb731 Fix GitMembership with a hammer (#1420)
While investigating pytest, I discovered this test class was not
imported in AllTests, so it never ran, and worse, it would always fail
because it would get a NamedUser, and not an AuthenticatedUser. Add it
in it, and hit it with a hammer until it passes.
2020-03-06 22:54:42 +11:00
Steve Kowalik 1c82573d6f Add support to reply to a Pull request comment (#1374)
* Add create_review_comment_reply to PullRequest

* Add unit tests

* Add docs for comment_id param for create_review_comment_reply

* Update tests

* Fix pep8 styling issue

* Fix styling
2020-03-06 11:13:12 +11:00
Steve Kowalik 806130e93d PullRequest.update_branch(): allow expected_head_sha to be empty (#1412)
* PullRequest.update_branch(): allow expected_head_sha to be empty

* PullRequest.testUpdateBranch(): test also with empty expected_head_sha

* Updated replay data for PullRequest.testUpdateBranch

* tox formatted changes
2020-03-06 11:00:40 +11:00
Steve Kowalik aeb27b788c Implement ProjectCard.delete() (#1417)
To work towards implementing more of the API surrounding Project Cards,
add a delete method. With thanks to Christopher Mitchell, Ph.D.

Fixes #1409
2020-03-05 15:35:04 +11:00
Wan Liuyang d6f2795342 Create FUNDING.yml 2020-02-28 08:20:51 +08:00
Steve Kowalik 2991e9f178 Unpin coverage to 5.0.3 only (#1397)
To not force distributions to patch our requirements, loosen the
coverage test dependency.
2020-02-14 14:32:23 +11:00
Wan Liuyang 08b1c474b3 Add pre-commit plugin for black/isort/flake8 (#1398)
* Add pre-commit plugin for black/isort/flake8

* Update .pre-commit-config.yaml

* Add a few more useful hooks
2020-02-13 18:49:35 +08:00
Wan Liuyang 125536fe69 Add tox (#1388)
* Add tox.ini

* Fix typo

* Update .gitignore

* Move flake8 to tox

* Add py35

* Add Coverage

* Add Coverage

* Add Coverage

* Add Coverage

* Add black

* Add black

* Add black

* Skip black for py35

* Add isort

* Update contributing docs

* Remove empty line
2020-02-13 17:54:02 +08:00
Isac Souza 0396a4931a Open file in text mode in scripts/add_attribute.py (#1396) 2020-02-13 12:59:28 +11:00
Steve Kowalik dd31a70659 Silence most ResourceWarnings (#1393)
A few test classes were failing to call tearDown() of the superclass,
which meant the file descriptors of their replydata files were leaking.
Make sure to call it, and switch every other callsite of superclasses by
name to using argument-less super().

Revert an AllTests change that snuck in during release.
2020-02-12 15:05:32 +11:00
Wan Liuyang f8bf46f82b black 2020-02-12 02:01:58 +08:00
Steve Kowalik d6dee0164a Assert more attributes in Membership (#1391)
To increase code coverage, assert more attributes in Membership.
2020-02-11 16:33:04 +11:00
Steve Kowalik 6e3ceb193b Assert on changed Repository attributes (#1390)
To increase code coverage, assert on more attributes of Repository
during the testEditWithAllArguments testcase.
2020-02-11 14:53:15 +11:00
Steve KowalikandJonathan Leitschuh 0829af815f Add reset to the repr for Rate (#1389)
Add the reset attribute to the repr for Rate, and add a test for good
measure.

Co-Authored-By: Jonathan Leitschuh <jonathan.leitschuh@gmail.com>
2020-02-11 14:17:52 +11:00
Steve Kowalik e5ce4912f5 Publish version 1.46 2020-02-11 12:33:45 +11:00
Glenn McDonald 9564cd4de7 Add repo edit support for delete_branch_on_merge (#1381)
* Add repo edit support for delete_branch_on_merge

* Assert delete_branch_on_merge
2020-02-11 12:24:33 +11:00
Steve Kowalik 784deb5f68 Run black over the entire tree (#1386)
It's been a while since black was run over the entire tree, and since CI
still doesn't check it, we can get behind.
2020-02-11 10:37:25 +11:00
Wan Liuyang e76cc11271 Remove Travisbuddy 2020-02-11 00:31:39 +08:00