To build on the previous work supporting querying Workflows for GitHub
Actions, add a class and relevant methods to support querying runs of a
workflow.
The test class for GitReleaseAsset did not match the filename, was also
the only class to include docstrings, and furthermore, repeated a lot of
fetches in the replay data.
The two unit tests for NamedUser.get_repos() did not check all
arguments, and this was the only method in the file that wasn't
completly covered. Re-record the replay data while passing all arguments
to the method.
While chasing coverage failures, I discovered PullRequestReview's do not
send back a URL at all, which means firstly, the url property is not
required because it will always be None, and secondly, the object can
never be completed. I'm not certain why this change broke the test, but
it looked brittle, refactor it to be clearer.
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.
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.
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.
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.
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.
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.
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.
* 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()
* 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
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
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
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.
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.
* 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
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.