Skip to content

tests: GithubException now accepts also headers#1070

Merged
softwarefactory-project-zuul[bot] merged 1 commit intopackit:mainfrom
TomasTomecek:fix-test-reporting
Apr 28, 2021
Merged

tests: GithubException now accepts also headers#1070
softwarefactory-project-zuul[bot] merged 1 commit intopackit:mainfrom
TomasTomecek:fix-test-reporting

Conversation

@TomasTomecek
Copy link
Copy Markdown
Member

We need to update how we mock GithubException since 1.55 it now accepts
HTTP headers in form of a positional argument as well:

PyGithub/PyGithub#1887

Kudos @lbarcziova

Copy link
Copy Markdown
Member

@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TomasTomecek TomasTomecek added mergeit Merge via Zuul and removed mergeit Merge via Zuul labels Apr 28, 2021
@softwarefactory-project-zuul
Copy link
Copy Markdown
Contributor

Build failed.

We need to update how we mock GithubException since 1.55 it now accepts
HTTP headers in form of a positional argument as well:

PyGithub/PyGithub#1887

This is implemented with inspect.signature so our tests work for both
versions of pygithub <1.55 and >=1.55 because 1.55 is not in stable
Fedora yet.

Kudos @lbarcziova

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
Comment on lines +175 to +186
github.GithubException,
# https://docs.python.org/3/library/inspect.html#inspect.signature
# to account for changes in positional arguments: pygithub 1.55 added headers
# as additional positional argument; this creates an iterable and sets None
# for every argument of GithubException.__init__ except for 'self'
[
None
for param_name, param in signature(
github.GithubException.__init__
).parameters.items()
if param_name != "self"
],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution!

Copy link
Copy Markdown
Member

@lbarcziova lbarcziova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@softwarefactory-project-zuul
Copy link
Copy Markdown
Contributor

Build succeeded.

@TomasTomecek TomasTomecek added the mergeit Merge via Zuul label Apr 28, 2021
@softwarefactory-project-zuul
Copy link
Copy Markdown
Contributor

Build succeeded (gate pipeline).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mergeit Merge via Zuul

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants