1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Mock out getcwd.

File urls on Windows32 are fragile, the test doesn't actually care about
the filesystem as it's already mocking exists and isdir.

Hopefully fixes two win32 build failures.
This commit is contained in:
Paul Nasrat 2012-06-06 13:29:24 +01:00
parent dafaabe89b
commit 91e4ec3e37

View file

@ -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():
@ -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():