Example #1
0
    def test_get_name_default(self, mock_input):
        mock_input.return_value = ''

        i = Virtualenv()
        name = i.get_name()

        self.assertEqual(name, 'foo')
Example #2
0
    def test_get_name_default(self, mock_input):
        mock_input.return_value = ''

        i = Virtualenv()
        name = i.get_name()

        self.assertEqual(name, 'foo')
Example #3
0
    def test_get_name(self, mock_input):
        mock_input.return_value = 'bar'

        i = Virtualenv()
        name = i.get_name()

        self.assertEqual(name, 'bar')
Example #4
0
    def test_get_name(self, mock_input):
        mock_input.return_value = 'bar'

        i = Virtualenv()
        name = i.get_name()

        self.assertEqual(name, 'bar')
Example #5
0
    def test_get_path(self, mock_get_name, mock_input):
        mock_get_name.return_value = 'baz'
        mock_input.return_value = '/foo/bar'

        i = Virtualenv()
        path = i.get_path()

        self.assertEqual(path, '/foo/bar/baz')
Example #6
0
    def test_get_path(self, mock_get_name, mock_input):
        mock_get_name.return_value = 'baz'
        mock_input.return_value = '/foo/bar'

        i = Virtualenv()
        path = i.get_path()

        self.assertEqual(path, '/foo/bar/baz')
Example #7
0
    def test_get_path_default(self, mock_get_name, mock_input):
        mock_get_name.return_value = 'baz'
        mock_input.return_value = ''
        user_dir = os.path.expanduser('~')

        i = Virtualenv()
        path = i.get_path()

        self.assertEqual(path, os.path.join(user_dir, '.virtualenvs', 'baz'))
Example #8
0
    def test_get_path_default(self, mock_get_name, mock_input):
        mock_get_name.return_value = 'baz'
        mock_input.return_value = ''
        user_dir = os.path.expanduser('~')

        i = Virtualenv()
        path = i.get_path()

        self.assertEqual(path, os.path.join(user_dir, '.virtualenvs', 'baz'))
Example #9
0
    def test_create_import_error(self, mock_sh_import):
        mock_sh_import.side_effect = ImportError

        i = Virtualenv()
        path = i.create()
        warn = self.mocked_facio_hooks_python_virtualenv_Virtualenv_warning

        self.assertEqual(path, None)
        warn.assert_called_with("Please install virtualenv to use the "
                                "python virtualenv hooks")
Example #10
0
    def test_create(self, mock_get_path, mock_input, mock_virtualenv):
        mock_get_path.return_value = '/foo/bar/baz'
        mock_input.return_value = ''

        i = Virtualenv()
        path = i.create()

        mock_virtualenv.assert_called_with('/foo/bar/baz',
                                           '--no-site-packages')
        self.assertEqual(path, '/foo/bar/baz')
Example #11
0
    def test_create_import_error(self, mock_sh_import):
        mock_sh_import.side_effect = ImportError

        i = Virtualenv()
        path = i.create()
        warn = self.mocked_facio_hooks_python_virtualenv_Virtualenv_warning

        self.assertEqual(path, None)
        warn.assert_called_with("Please install virtualenv to use the "
                                "python virtualenv hooks")
Example #12
0
    def test_create(self, mock_get_path, mock_input, mock_virtualenv):
        mock_get_path.return_value = '/foo/bar/baz'
        mock_input.return_value = ''

        i = Virtualenv()
        path = i.create()

        mock_virtualenv.assert_called_with('/foo/bar/baz',
                                           '--no-site-packages')
        self.assertEqual(path, '/foo/bar/baz')
Example #13
0
    def test_create_venv_exception(self, mock_get_path, mock_input,
                                   mock_virtualenv):
        mock_get_path.return_value = '/foo/bar/baz'
        mock_virtualenv.side_effect = Exception

        i = Virtualenv()
        path = i.create()
        err = self.mocked_facio_hooks_python_virtualenv_Virtualenv_error

        self.assertEqual(path, None)
        err.assert_called_with("Failed to create virtual "
                               "environment at: /foo/bar/baz")
Example #14
0
    def test_create_venv_exception(self, mock_get_path, mock_input,
                                   mock_virtualenv):
        mock_get_path.return_value = '/foo/bar/baz'
        mock_virtualenv.side_effect = Exception

        i = Virtualenv()
        path = i.create()
        err = self.mocked_facio_hooks_python_virtualenv_Virtualenv_error

        self.assertEqual(path, None)
        err.assert_called_with("Failed to create virtual "
                               "environment at: /foo/bar/baz")