def test_happy(self): fake_base = os.path.abspath(os.path.join('pretends_to_exist')) fake_name = 'also_pretend' fake_path = os.path.join(fake_base, fake_name) fake_exists = make_fake_exists([fake_base, fake_path]) with patch('os.path.exists', wraps=fake_exists): path = main.get_virtualenv_path(fake_base, fake_name) assert path == fake_path
def test_nonexistent_ve_path(self): fake_path = os.path.abspath(os.path.join('pretends_to_exist')) fake_exists = make_fake_exists([fake_path]) with patch('os.path.exists', wraps=fake_exists), \ raises(exceptions.InvalidVirtualenv): main.get_virtualenv_path(fake_path, "/unlikely_to_exist2")
def test_nonexistent_ve_base(self): with raises(exceptions.NoVirtualenvsDirectory): main.get_virtualenv_path("/unlikely_to_exist1", "anything")
def test_no_ve_base(self): with raises(exceptions.NoVirtualenvsDirectory): main.get_virtualenv_path("", "anything")
def test_no_ve_name(self): fake_path = os.path.abspath(os.path.join("pretends_to_exist")) fake_exists = make_fake_exists([fake_path]) with patch("os.path.exists", wraps=fake_exists), \ raises(exceptions.InvalidVirtualenv): main.get_virtualenv_path(fake_path, "")