コード例 #1
0
ファイル: server.py プロジェクト: skoczen/lettuce
    def start(self):
        """Starts the webserver thread, and waits it to be available"""
        call_hook('before', 'runserver', self._actual_server)
        try:
            # If we're in 1.4+, just use the built in LiveServer in django.
            from django.test.testcases import LiveServerTestCase
            os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = "%s:%s" % (self.address, self.port,)
            addrport = self.address, self.port
            LiveServerTestCase.setUpClass()
        except:
            if self._actual_server.should_serve_admin_media():
                msg = "Preparing to serve django's admin site static files"
                if getattr(settings, 'LETTUCE_SERVE_ADMIN_MEDIA', False):
                    msg += ' (as per settings.LETTUCE_SERVE_ADMIN_MEDIA=True)'

                print "%s..." % msg

            self._actual_server.start()
            self._actual_server.wait()

            addrport = self.address, self._actual_server.port
            if not self._actual_server.is_alive():
                raise LettuceServerException(
                    'Lettuce could not run the builtin Django server at %s:%d"\n'
                    'maybe you forgot a "runserver" instance running ?\n\n'
                    'well if you really do not want lettuce to run the server '
                    'for you, then just run:\n\n'
                    'python manage.py --no-server' % addrport,
                )

        print "Django's builtin server is running at %s:%d" % addrport
コード例 #2
0
ファイル: server.py プロジェクト: skoczen/lettuce
    def start(self):
        """Starts the webserver thread, and waits it to be available"""
        call_hook('before', 'runserver', self._actual_server)
        try:
            # If we're in 1.4+, just use the built in LiveServer in django.
            from django.test.testcases import LiveServerTestCase
            os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = "%s:%s" % (
                self.address,
                self.port,
            )
            addrport = self.address, self.port
            LiveServerTestCase.setUpClass()
        except:
            if self._actual_server.should_serve_admin_media():
                msg = "Preparing to serve django's admin site static files"
                if getattr(settings, 'LETTUCE_SERVE_ADMIN_MEDIA', False):
                    msg += ' (as per settings.LETTUCE_SERVE_ADMIN_MEDIA=True)'

                print "%s..." % msg

            self._actual_server.start()
            self._actual_server.wait()

            addrport = self.address, self._actual_server.port
            if not self._actual_server.is_alive():
                raise LettuceServerException(
                    'Lettuce could not run the builtin Django server at %s:%d"\n'
                    'maybe you forgot a "runserver" instance running ?\n\n'
                    'well if you really do not want lettuce to run the server '
                    'for you, then just run:\n\n'
                    'python manage.py --no-server' % addrport, )

        print "Django's builtin server is running at %s:%d" % addrport
コード例 #3
0
ファイル: server.py プロジェクト: soulhave/lettuce
        def start(self):
            super(DjangoServer, self).start()

            os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = \
                    '{address}:{port}'.format(address=self.address,
                                              port=self.port)
            LiveServerTestCase.setUpClass()

            print "Django's builtin server is running at {address}:{port}".format(
                address=self.address, port=self.port)
コード例 #4
0
ファイル: server.py プロジェクト: rpaloschi/lettuce
        def start(self):
            super(DjangoServer, self).start()

            os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = \
                    '{address}:{port}'.format(address=self.address,
                                              port=self.port)
            LiveServerTestCase.setUpClass()

            print("Django's builtin server is running at {address}:{port}".format(
                address=self.address,
                port=self.port))
コード例 #5
0
def django_test_case(context):
    context.test = LiveServerTestCase()
    context.test._pre_setup()
    context.test.setUpClass()
    yield
    context.test.tearDownClass()
    context.test._post_teardown()  # flush DB
    del context.test
コード例 #6
0
ファイル: server.py プロジェクト: skoczen/lettuce
    def stop(self, fail=False):
        try:
            # If we're in 1.4+, just use the built in LiveServer in django.
            from django.test.testcases import LiveServerTestCase
            LiveServerTestCase.tearDownClass()
            code = 0
        except:
            from traceback import print_exc
            print_exc()
            pid = self._actual_server.pid
            if pid:
                os.kill(pid, 9)

            code = int(fail)

        call_hook('after', 'runserver', self._actual_server)
        return code
コード例 #7
0
ファイル: server.py プロジェクト: skoczen/lettuce
    def stop(self, fail=False):
        try:
            # If we're in 1.4+, just use the built in LiveServer in django.
            from django.test.testcases import LiveServerTestCase
            LiveServerTestCase.tearDownClass()
            code = 0
        except:
            from traceback import print_exc
            print_exc()
            pid = self._actual_server.pid
            if pid:
                os.kill(pid, 9)

            code = int(fail)

        call_hook('after', 'runserver', self._actual_server)
        return code
コード例 #8
0
ファイル: server.py プロジェクト: rpaloschi/lettuce
        def stop(self, fail=False):
            LiveServerTestCase.tearDownClass()

            super(DjangoServer, self).stop()

            return 0
コード例 #9
0
ファイル: server.py プロジェクト: soulhave/lettuce
        def stop(self, fail=False):
            LiveServerTestCase.tearDownClass()

            super(DjangoServer, self).stop()

            return 0