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

Add 'sshkey' context manager#242

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
Byron merged 6 commits intogitpython-developers:masterfromteeberg:master
Jan 22, 2015
Merged

Add 'sshkey' context manager#242

Byron merged 6 commits intogitpython-developers:masterfromteeberg:master
Jan 22, 2015

Conversation

teeberg
Copy link
Contributor

Proposed implementation for#234

I have done some manual tests, but not set up automated tests yet. I will see how it fits into your suite tomorrow if you haven't implemented it yet. :)

Let me know if something's not quite in the right place.

@teebergteeberg changed the titleAddsshkey context managerAdd 'sshkey' context managerJan 21, 2015
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling8fbe7ee on teeberg:master intobb0f3d7 on gitpython-developers:master.

self.set_environment(**old_env)

@contextmanager
def sshkey(self, sshkey_file):
Copy link
Member

Choose a reason for hiding this comment

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

For a moment I thought this method is to specific, but on the other hand, it makes setting ssh-keys (by using key-files) really easy.
Therefore the only thing I will do is see how this works on windows, and possibly put in an assertion to run on non-windows systems only.

@Byron
Copy link
Member

Thank you !
It looks very good already, and is more feature-rich than I would have done it, thanks to your personal interest.

@@ -153,3 +153,23 @@ def test_env_vars_passed_to_git(self):
editor = 'non_existant_editor'
with mock.patch.dict('os.environ', {'GIT_EDITOR': editor}):
assert self.git.var("GIT_EDITOR") == editor

def test_environment(self):
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I don't see how I could test thesshkey context manager without accessing an actual repo. Also, how could I check whether the environment is actually passed into the git process? The former would cover the latter. Do you have ideas?

Copy link
Member

Choose a reason for hiding this comment

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

Something that could work is to adjust the script for the test to actually fail with a distinct error code, and possibly emit something distinctive to STDERR.
That way, you could call the real git process, on a bogus git@server:foo/bar repo URL, and verify that it failed under your conditions. That can proof that the script was actually called.
The cool thing is that this would require you to put in a way to adjust the path the script handling the GIT_SSH, which could be done so that advanced users can either set it, or derive from the Git command implementation.

@coveralls
Copy link

Coverage Status

Coverage remained the same at % when pulling6f03861 on teeberg:master intod565a87 on gitpython-developers:master.

@Byron
Copy link
Member

You did it !
The only minor issue I am still choking on is thewith repo.git.with_environment(...) notation of the context manager and the seemingly redundant use ofwith_ .

Note to self: Test this on windows and at least throw saying sshkey doesn't work, if it doesn't work

Also I believe today will be the day, as I should get through my docs review, and prepare a new release.

@ByronByron merged commit6f03861 intogitpython-developers:masterJan 22, 2015
@Byron
Copy link
Member

Before I forget: I had to removesshkey from the release, as I was unable to tellsetup.py to keep that file where it is after installation, AND keep it executable.
I think I even recorded my futile attempt to beat setuptools in all it's glory and uploaded it on youtube.

@teeberg
Copy link
ContributorAuthor

Thanks for the note, I already saw it! :) I didn't realise it would be such a pain! I'll stick with my local SSH script then in the meantime. :-) Thanks for merging everything else in!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@teeberg@coveralls@Byron

[8]ページ先頭

©2009-2025 Movatter.jp