Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: handle situation where gitlab.com does not return values#1773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nejch merged 1 commit intomainfromjlvillal/pagination
Dec 31, 2021

Conversation

JohnVillalovos
Copy link
Member

If a query returns more than 10,000 records than the following values
are NOT returned:
x.total_pages
x.total

Modify the code to allow no value to be set for these values. If there
is not a value returned the functions will now return None.

https://docs.gitlab.com/ee/user/gitlab_com/index.html#pagination-response-headers

Closes#1686

@codecov-commenter
Copy link

codecov-commenter commentedDec 22, 2021
edited
Loading

Codecov Report

Merging#1773 (cb824a4) intomain (501f9a1) willincrease coverage by0.00%.
The diff coverage is100.00%.

@@           Coverage Diff           @@##             main    #1773   +/-   ##=======================================  Coverage   91.96%   91.97%           =======================================  Files          76       76             Lines        4754     4758    +4     =======================================+ Hits         4372     4376    +4  Misses        382      382
FlagCoverage Δ
cli_func_v481.21% <62.50%> (-0.07%)⬇️
py_func_v480.62% <62.50%> (-0.07%)⬇️
unit83.18% <100.00%> (+0.01%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

Impacted FilesCoverage Δ
gitlab/base.py90.22% <100.00%> (ø)
gitlab/client.py90.10% <100.00%> (+0.10%)⬆️

@JohnVillalovosJohnVillalovosforce-pushed thejlvillal/pagination branch 2 times, most recently fromca2e8e0 to971a617CompareDecember 22, 2021 22:38
@nejch
Copy link
Member

LGTM I'd just like to reproduce#1686 in some tests first with an xfail (e.g. I'll see if I can get responses to match the presence/absence of those headers). Are you ok to wait and rebase@JohnVillalovos (unless you want to take a look at it yourself but you already have a few PRs :D)

@JohnVillalovos
Copy link
MemberAuthor

LGTM I'd just like to reproduce#1686 in some tests first with an xfail (e.g. I'll see if I can get responses to match the presence/absence of those headers). Are you ok to wait and rebase@JohnVillalovos (unless you want to take a look at it yourself but you already have a few PRs :D)

Works for me. Thanks!

@nejch
Copy link
Member

I have#1788 ready for this and I also saw I was being overly pedantic as we're already doing the same with one-liners 😅 :

@property
defprev_page(self)->Optional[int]:
"""The previous page number.
If None, the current page is the first.
"""
returnint(self._prev_page)ifself._prev_pageelseNone
@property
defnext_page(self)->Optional[int]:
"""The next page number.
If None, the current page is the last.
"""
returnint(self._next_page)ifself._next_pageelseNone

JohnVillalovos reacted with thumbs up emoji

@JohnVillalovosJohnVillalovosforce-pushed thejlvillal/pagination branch 2 times, most recently from4a17937 toc308c30CompareDecember 30, 2021 19:32
@JohnVillalovos
Copy link
MemberAuthor

I have#1788 ready for this and I also saw I was being overly pedantic as we're already doing the same with one-liners 😅 :

Thanks. I reviewed and merged#1788. Then rebased this PR. Was surprised that if anxfail marked test passes it doesn't cause things to fail 😕 Removed thexfail, and it is working as expected now.

If a query returns more than 10,000 records than the following valuesare NOT returned:  x.total_pages  x.totalModify the code to allow no value to be set for these values. If thereis not a value returned the functions will now return None.Update unit test so no longer `xfail`https://docs.gitlab.com/ee/user/gitlab_com/index.html#pagination-response-headersCloses#1686
@JohnVillalovos
Copy link
MemberAuthor

Was surprised that if anxfail marked test passes it doesn't cause things to fail 😕

I figured that out and addedxfail_strict to thepytest configuration. Now if anxfail test passes it will cause the test run to fail.

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

Reviewers

@nejchnejchAwaiting requested review from nejch

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

int() argument must be a string, a bytes-like object or a real number, not 'NoneType' while accessing pagination related attributes

3 participants

@JohnVillalovos@codecov-commenter@nejch

[8]ページ先頭

©2009-2025 Movatter.jp