Exemplo n.º 1
0
    def suspend_test_check_install(self):
        import pip

        # discard the argparser errors
        with patch("sys.stdout", self.stdout):
            with patch("sys.stderr", self.stderr):
                # clean the virtualenv
                try:
                    pip.main(["uninstall", "-y", "psycopg2"])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass
                try:
                    pip.main(["uninstall", "-y", "pillow"])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass
                try:
                    pip.main(["uninstall", "-y", "mysql-python"])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass

                # Check postgres / pillow
                conf_data = config.parse(
                    [
                        "-q",
                        "--db=postgres://user:pwd@host/dbname",
                        "--django-version=1.4",
                        "--i18n=no",
                        "-f",
                        "-p" + self.project_dir,
                        "example_prj",
                    ]
                )
                with self.assertRaises(EnvironmentError) as context_error:
                    check_install(conf_data)
                self.assertTrue(str(context_error.exception).find("Pillow is not installed") > -1)
                self.assertTrue(str(context_error.exception).find("PostgreSQL driver is not installed") > -1)

                # Check mysql
                conf_data = config.parse(
                    [
                        "-q",
                        "--db=mysql://user:pwd@host/dbname",
                        "--django-version=1.4",
                        "--i18n=no",
                        "-f",
                        "-p" + self.project_dir,
                        "example_prj",
                    ]
                )
                with self.assertRaises(EnvironmentError) as context_error:
                    check_install(conf_data)
                self.assertTrue(str(context_error.exception).find("MySQL driver is not installed") > -1)
Exemplo n.º 2
0
    def suspend_test_check_install(self):
        import pip
        # discard the argparser errors
        with patch('sys.stdout', self.stdout):
            with patch('sys.stderr', self.stderr):
                # clean the virtualenv
                try:
                    pip.main(['uninstall', '-y', 'psycopg2'])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass
                try:
                    pip.main(['uninstall', '-y', 'pillow'])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass
                try:
                    pip.main(['uninstall', '-y', 'mysql-python'])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass

                # Check postgres / pillow
                conf_data = config.parse([
                    '-q', '--db=postgres://user:pwd@host/dbname',
                    '--django-version=1.4', '--i18n=no', '-f',
                    '-p' + self.project_dir, 'example_prj'
                ])
                with self.assertRaises(EnvironmentError) as context_error:
                    check_install(conf_data)
                self.assertTrue(
                    str(context_error.exception).find(
                        'Pillow is not installed') > -1)
                self.assertTrue(
                    str(context_error.exception).find(
                        'PostgreSQL driver is not installed') > -1)

                # Check mysql
                conf_data = config.parse([
                    '-q', '--db=mysql://user:pwd@host/dbname',
                    '--django-version=1.4', '--i18n=no', '-f',
                    '-p' + self.project_dir, 'example_prj'
                ])
                with self.assertRaises(EnvironmentError) as context_error:
                    check_install(conf_data)
                self.assertTrue(
                    str(context_error.exception).find(
                        'MySQL driver is not installed') > -1)
Exemplo n.º 3
0
    def suspend_test_check_install(self):
        import pip
        # discard the argparser errors
        with patch('sys.stdout', self.stdout):
            with patch('sys.stderr', self.stderr):
                # clean the virtualenv
                try:
                    pip.main(['uninstall', '-y', 'psycopg2'])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass
                try:
                    pip.main(['uninstall', '-y', 'pillow'])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass
                try:
                    pip.main(['uninstall', '-y', 'mysql-python'])
                except pip.exceptions.UninstallationError:
                    ## package not installed, all is fine
                    pass

                # Check postgres / pillow
                conf_data = config.parse([
                    '-q',
                    '--db=postgres://user:pwd@host/dbname',
                    '--django-version=1.4',
                    '--i18n=no',
                    '-f',
                    '-p'+self.project_dir,
                    'example_prj'])
                with self.assertRaises(EnvironmentError) as context_error:
                    check_install(conf_data)
                self.assertTrue(str(context_error.exception).find('Pillow is not installed') > -1)
                self.assertTrue(str(context_error.exception).find('PostgreSQL driver is not installed') > -1)

                # Check mysql
                conf_data = config.parse([
                    '-q',
                    '--db=mysql://user:pwd@host/dbname',
                    '--django-version=1.4',
                    '--i18n=no',
                    '-f',
                    '-p'+self.project_dir,
                    'example_prj'])
                with self.assertRaises(EnvironmentError) as context_error:
                    check_install(conf_data)
                self.assertTrue(str(context_error.exception).find('MySQL driver is not installed') > -1)