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

test(ci): create a dummy ~/.python-gitlab.cfg file#2174

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

Closed
JohnVillalovos wants to merge1 commit intomainfromjlvillal/create_config

Conversation

JohnVillalovos
Copy link
Member

@JohnVillalovosJohnVillalovos commentedJul 23, 2022
edited
Loading

Create a working ~/.python-gitlab.cfg file when running the unit
tests in the CI. This is to ensure our unit tests still work if a config file
exists.

@JohnVillalovos
Copy link
MemberAuthor

Once PR#2173 is merged, then this will pass the CI.

@JohnVillalovosJohnVillalovosforce-pushed thejlvillal/create_config branch 2 times, most recently from9855d56 to183d6ffCompareJuly 24, 2022 03:17
Create a working ~/.python-gitlab.cfg file when running the unit testsin the CI. This is to ensure our unit tests still work if a configfile exists.
@JohnVillalovosJohnVillalovos changed the titletest: create a dummy ~/.python-gitlab.cfg filetest(ci): create a dummy ~/.python-gitlab.cfg fileJul 29, 2022
@codecov-commenter
Copy link

Codecov Report

Merging#2174 (0f4fa8f) intomain (8ba97aa) willincrease coverage by4.00%.
The diff coverage isn/a.

@@            Coverage Diff             @@##             main    #2174      +/-   ##==========================================+ Coverage   91.56%   95.56%   +4.00%==========================================  Files          81       81                Lines        5344     5344              ==========================================+ Hits         4893     5107     +214+ Misses        451      237     -214
FlagCoverage Δ
api_func_v481.41% <ø> (?)
cli_func_v483.06% <ø> (-0.10%)⬇️
unit87.31% <ø> (ø)

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

Impacted FilesCoverage Δ
gitlab/utils.py98.59% <0.00%> (+1.40%)⬆️
gitlab/v4/objects/members.py94.82% <0.00%> (+1.72%)⬆️
gitlab/client.py98.70% <0.00%> (+3.44%)⬆️
gitlab/types.py98.21% <0.00%> (+3.57%)⬆️
gitlab/v4/objects/notes.py94.28% <0.00%> (+3.80%)⬆️
gitlab/v4/objects/groups.py89.40% <0.00%> (+3.97%)⬆️
gitlab/v4/objects/pages.py100.00% <0.00%> (+5.00%)⬆️
gitlab/v4/objects/events.py98.73% <0.00%> (+5.06%)⬆️
gitlab/mixins.py92.30% <0.00%> (+5.49%)⬆️
gitlab/v4/objects/environments.py100.00% <0.00%> (+5.88%)⬆️
... and21 more

@nejch
Copy link
Member

We have since added#2187 where we ignore default files including /etc/python-gitlab.cfg now at root-level.

@JohnVillalovos
Copy link
MemberAuthor

We have since added#2187 where we ignore default files including /etc/python-gitlab.cfg now at root-level.

True. But what if in the future we break it accidentally...

I don't have that strong of feelings about this but just thought a little extra safety.

@JohnVillalovos
Copy link
MemberAuthor

It's fine with me if you want to go ahead and just close it 👍

@nejch
Copy link
Member

I'm still thinking about what to do with it :D for me not having extra bash scripts would be nicer*, as it usually doesn't make sense to lint them and other contributors would then get comfortable and start adding more and more potentially, but I also get your point. Maybe also atests/conftest.py fixture that is autoused and always first would be an option but probably also overkill.

*I'm biased because I removed a bunch of themhttps://github.com/python-gitlab/python-gitlab/tree/v2.2.0/tools :D

@nejch
Copy link
Member

nejch commentedOct 18, 2022
edited
Loading

I think this could also be implemented as a top-level fixture, to keep things in one language and less code.

tests/conftest.py:

importosfrompathlibimportPath@pytest.fixture(autouse=True,scope="session")defdummy_config()->None:"""    Creates a dummy config file that should never affect our tests.    See https://github.com/python-gitlab/python-gitlab/issues/2172.    """config=Path.home()/".python-gitlab.cfg"ifconfig.exists()or"CI"notinos.environ:returnconfig.write_text("""[global]default = gitlab[gitlab]url = https://gitlab.example.comprivate_token = not-a-valid-token""")yieldconfig.unlink(missing_ok=True)

For good measure, could also be included in the gitlab fixture then to ensure it's loaded first.https://stackoverflow.com/a/38611500/15836334

lmilbaum reacted with thumbs up emoji

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

@JohnVillalovosJohnVillalovos

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@JohnVillalovos@codecov-commenter@nejch

[8]ページ先頭

©2009-2025 Movatter.jp