jupyterhub / nbgitpuller

Jupyter server extension to sync a git repository one-way to a local path
https://nbgitpuller.readthedocs.io
BSD 3-Clause "New" or "Revised" License
212 stars 86 forks source link

Fix test_exception_branch_exists #287

Closed a3626a closed 1 year ago

a3626a commented 1 year ago

Recently, I have ported a portion of nbgitpuller into Ruby On Rails compatible ruby version. Meanwhile, I have found that 'test_exception_branch_exists' doesn't test anything. Actually puller.gp.branch_exists("wrong") was not throwing any errors, and assert type(e) == ValueError was not called at all.

I refered test_exception_resolve_default_branch and test_git_lock, and introduced exception_raised variable and puller.gp.git_url = "" assignment.

welcome[bot] commented 1 year ago

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly. welcome You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

yuvipanda commented 1 year ago

Ah, thanks for looking into this!

Can you rework this to use https://docs.pytest.org/en/7.1.x/how-to/assert.html#assertions-about-expected-exceptions instead? That's the expected way to test for expected exceptions in pytest I think.

a3626a commented 1 year ago

Ah, thanks for looking into this!

Can you rework this to use https://docs.pytest.org/en/7.1.x/how-to/assert.html#assertions-about-expected-exceptions instead? That's the expected way to test for expected exceptions in pytest I think.

Of course, that is great. It is done.

yuvipanda commented 1 year ago

Thanks @a3626a. Looks like the test failures may be related?

a3626a commented 1 year ago

@yuvipanda

Thanks @a3626a. Looks like the test failures may be related?

It is really done!

welcome[bot] commented 1 year ago

Congrats on your first merged pull request in this project! :tada: congrats Thank you for contributing, we are very proud of you! :heart: