Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock out getcwd. #568

Merged
merged 1 commit into from
Jun 6, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions tests/test_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,19 @@ def test_requirements_data_structure_implements__contains__():
assert 'pip' in requirements
assert 'nose' not in requirements

@patch('pip.req.os.getcwd')
@patch('pip.req.os.path.exists')
@patch('pip.req.os.path.isdir')
def test_parse_editable_local(isdir_mock, exists_mock):
def test_parse_editable_local(isdir_mock, exists_mock, getcwd_mock):
exists_mock.return_value = isdir_mock.return_value = True
getcwd_mock.return_value = "/some/path"
assert_equal(
parse_editable('.', 'git'),
(None, 'file://' + os.getcwd(), None)
(None, 'file:///some/path', None)
)
assert_equal(
parse_editable('foo', 'git'),
(None, 'file://' + os.path.join(os.getcwd(), 'foo'), None)
(None, 'file://' + os.path.join("/some/path", 'foo'), None)
)

def test_parse_editable_default_vcs():
Expand All @@ -152,17 +154,19 @@ def test_parse_editable_vcs_extras():
('foo[extras]', 'svn+https://foo#egg=foo[extras]', None)
)

@patch('pip.req.os.getcwd')
@patch('pip.req.os.path.exists')
@patch('pip.req.os.path.isdir')
def test_parse_editable_local_extras(isdir_mock, exists_mock):
def test_parse_editable_local_extras(isdir_mock, exists_mock, getcwd_mock):
exists_mock.return_value = isdir_mock.return_value = True
getcwd_mock.return_value = "/some/path"
assert_equal(
parse_editable('.[extras]', 'git'),
(None, 'file://' + os.getcwd(), ('extras',))
(None, 'file://' + "/some/path", ('extras',))
)
assert_equal(
parse_editable('foo[bar,baz]', 'git'),
(None, 'file://' + os.path.join(os.getcwd(), 'foo'), ('bar', 'baz'))
(None, 'file://' + os.path.join("/some/path", 'foo'), ('bar', 'baz'))
)

def test_install_local_editable_with_extras():
Expand Down