Commit Graph
1848 Commits
Author SHA1 Message Date
Steve Kowalik 52ec366be4 Test more attributes (#1526)
To increase coverage, sprinkle in some asserts for attributes that were
not checked -- this uncovered a bug in Issue that two attributes were
not properly initialized to NotSet.
2020-05-21 09:58:50 +10:00
Steve Kowalik 1dd1cf9cb1 Remove pointless setters in GitReleaseAsset (#1527)
This is the only class that includes property setters for two of the
attributes, which are untested, and even if they were used, would have
no impact since there is no method to submit the changes back to GitHub.
Drop them.
2020-05-20 20:22:32 +10:00
Steve Kowalik d4b61311a1 Drop some unimplemented methods in GitRef (#1525)
There are two unimplemented methods in GitRef, which are mostly covered
by Commit.get_statuses(), remove them.
2020-05-20 18:31:25 +10:00
Steve Kowalik 61b610926a Remove unneeded duplicate string checks in Branch (#1524)
There were multiple calls checking if an element of a list was a string
or a string -- I suspect this pre-dates use of six in the code base, but
let's clean it up.
2020-05-20 12:37:52 +10:00
Steve Kowalik e79b9013fe Turn on coverage reporting for codecov (#1522)
Since we migrated from Travis to GitHub Actions, our coverage on codecov
has been reporting as 0%, since uploading the .coverage file is a
terrible idea. Turn on XML-based reporting, ignore the file and use that
when we upload to codecov.
2020-05-19 12:28:33 +10:00
Steve Kowalik 291c46303d Drastically increase coverage by checking repr() (#1521)
A lot of our missing coverage is caused by not checking repr(), which is
trivial enough to test against -- do so, and also clean up existing repr
tests to look the same by calling repr(). Where it was trivial, add a
few assertions about missing attributes.
2020-05-19 11:54:07 +10:00
Dominic Davis-Foster ce400bc770 Fixed formatting of docstrings for Repository.create_git_tag_and_release() and StatsPunchCard. (#1520) 2020-05-18 18:04:40 +10:00
Steve Kowalik 53d58d2b07 Remove Repository.topics (#1505)
The topics attribute has been replaced by Repository.get_topics(). To
reduce user confusion, delete the attribute.

Fixes #1504
2020-05-15 10:49:15 +10:00
Steve Kowalik 7b20b13d0b Small improvements to typing (#1517)
Work through some of the errors when running mypy with --strict.
2020-05-15 10:47:22 +10:00
Steve Kowalik 8727003fc8 Correct Repository.get_workflows() (#1518)
The API endpoint Repository.get_workflows() calls returns data in a list
item, not directly, leading to some head scratching when calling it
against GitHub. Re-record the replay data.
2020-05-14 16:45:01 +10:00
Max Wittig f7cc534d50 docs(repository): correct releases link (#1514) 2020-05-11 08:15:06 +08:00
Michael Hirsch, Ph.D b5737d4103 correct Repository.stargazers_count return type to int (#1513)
It appears this was a type annotation typo, as the type of the stargazers_count property has been int for a long time.
2020-05-11 09:57:32 +10:00
Steve Kowalik 5a8bc20314 Fix two RST warnings in Webhook.rst (#1512)
The final code block in the example is not Python code, and the
underlines were incorrect, correct both.
2020-05-11 09:56:53 +10:00
Steve Kowalik 09a1d9e4e7 Filter FutureWarning for 2 test cases (#1510)
There are two test cases that explicitly test with client_id and
client_secret, which means pytest helpfully tells us about them after
the test run concludes. We don't need to see them every run until we
drop the arguments, so filter them out for now.
2020-05-11 09:56:38 +10:00
Steve Kowalik 2475fa669a Raise a FutureWarning on use of client_{id,secret} (#1506)
client_id and client_secret are sent to GitHub encoded on the query
string, which GitHub has firmly deprecated, so much so as to email
people who are doing so. To discourage its use, raise a FutureWarning if
they are specified.

Fixes #1500
2020-05-05 21:23:22 +10:00
Sophie Alpert c7b5eff062 Improve type signature for create_from_raw_data (#1503)
Previously you could call it only on Repository or NamedUser. Now you can call it with any GithubObject subclass -- and the type is carried through to the return value.
2020-05-05 15:51:00 +10:00
Florent Clarret a32a896599 feat(column): move, edit and delete project columns (#1497)
Add support to move, edit and delete project columns.
2020-05-05 15:50:28 +10:00
Steve Kowalik a1ed7c0e2d Add support for Workflows (#1496)
To start supporting GitHub Actions, add the first part of that,
Workflow, which encapsulates a workflow over the API, along with
two methods on Repository to query them.
2020-05-05 15:49:45 +10:00
Chris de Graaf ba9d59c209 Add create_repository_dispatch to typing files (#1502) 2020-05-04 09:47:05 +08:00
Wan Liuyang 0ca534ee1c Publish version 1.51 2020-05-03 00:58:45 +08:00
Florent Clarret 63855409b9 feature: get the project column by id (#1466)
Add a method to fetch a project column by id.

Fixes #1057
2020-05-01 12:01:09 +10:00
Emily 6eba4506d4 Improve type stubs (#1489)
* Add type stubs for GithubException subclasses

* Install type stubs per PEP 561

See https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages.

* Make PaginatedList a generic type

* Add type stubs for __init__.py

* Add type stub for NamedUser.get_projects

* Add GithubObject superclasses to type stubs

Fixes #1490
2020-05-01 12:00:00 +10:00
Sam Pearlman 1c1cbb49c6 Fix typo in PullRequest.rst (#1494) 2020-05-01 09:55:39 +08:00
Liuyang WanandSteve Kowalik d6e77ba1e2 Drop Travis in favor of Github workflow (#1488)
* Drop Travis CI

* Update DEPLOY.md about new workflow of uploading new version to PyPI

* Upload coverage data to Codecov

Co-Authored-By: Steve Kowalik <steven@wedontsleep.org>
2020-04-27 21:54:20 +10:00
Wan Liuyang a9f174bd1d Publish version 1.50 2020-04-26 16:46:19 +08:00
Wan Liuyang 0b3b905a1b Disable travis publish to PyPI 2020-04-26 16:33:52 +08:00
Liuyang Wan fd5f013b75 Use Github action to upload to PyPI on new release (#1487) 2020-04-26 16:24:45 +08:00
Liuyang Wan 235fdc966d Github workflow improvement (#1486) 2020-04-26 16:04:42 +08:00
Liuyang Wan bde936b736 Update Travis badge with Github Action badge 2020-04-26 15:00:58 +08:00
Steve Kowalik 3551453eff Actually use the Python version in GA workflow (#1485)
It appears that the Python versions in our strategy matrix are not used
unless we drag them down into the steps. Do so now.
2020-04-26 14:56:08 +10:00
Liuyang Wan 546d601b50 Fix all type issues flagged by mypy (#1484) 2020-04-26 12:40:05 +08:00
Liuyang Wan 6a6e7c2614 Deprecate Gitter and add slack badge with auto invitation 2020-04-26 11:18:57 +08:00
Steve Kowalik 84bb69abff Drop use of shadow-cat for draft PRs (#1469) 2020-04-26 10:05:20 +08:00
Florent Clarret e0997b438e Add and handle the maintainer_can_modify attribute in PullRequest (#1465) 2020-04-26 10:04:12 +08:00
Nikolay Edigaryev 5cf9950b25 Ability to retrieve public events (#1481) 2020-04-26 10:03:54 +08:00
Florent Clarret d3bc6a5cd2 List matching references (#1471) 2020-04-26 10:03:36 +08:00
Steve Kowalik 38b34db56e AuthenticatedUser.get_organization_membership() should be str (#1473) 2020-04-26 10:02:34 +08:00
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