- Notifications
You must be signed in to change notification settings - Fork673
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Once PR#2173 is merged, then this will pass the CI. |
9855d56
to183d6ff
CompareCreate 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.
183d6ff
to0f4fa8f
Comparecodecov-commenter commentedJul 29, 2022
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown.Click here to find out more.
|
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. |
It's fine with me if you want to go ahead and just close it 👍 |
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 a *I'm biased because I removed a bunch of themhttps://github.com/python-gitlab/python-gitlab/tree/v2.2.0/tools :D |
nejch commentedOct 18, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think this could also be implemented as a top-level fixture, to keep things in one language and less code.
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 |
Uh oh!
There was an error while loading.Please reload this page.
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.