Skip to content

Commit

Permalink
Fixed #16683 -- Skip the IPv6 runserver tests if the platform doesn't…
Browse files Browse the repository at this point in the history
… support it.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17183 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jezdez committed Dec 9, 2011
1 parent 1a8b40c commit 154438e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/regressiontests/admin_scripts/tests.py
Expand Up @@ -7,6 +7,7 @@

import os
import shutil
import socket
import sys
import re

Expand Down Expand Up @@ -1056,10 +1057,13 @@ def test_app_with_import(self):
self.assertNoOutput(err)
self.assertOutput(out, '0 errors found')


class ManageRunserver(AdminScriptTestCase):
def setUp(self):
from django.core.management.commands.runserver import BaseRunserverCommand
def monkey_run(*args, **options): return

def monkey_run(*args, **options):
return

self.cmd = BaseRunserverCommand()
self.cmd.run = monkey_run
Expand All @@ -1080,7 +1084,8 @@ def test_runserver_addrport(self):
self.cmd.handle(addrport="7000")
self.assertServerSettings('127.0.0.1', '7000')

# IPv6
@unittest.skipUnless(socket.has_ipv6, 'markdown is installed')
def test_runner_addrport_ipv6(self):
self.cmd.handle(addrport="", use_ipv6=True)
self.assertServerSettings('::1', '8000', ipv6=True, raw_ipv6=True)

Expand All @@ -1090,18 +1095,19 @@ def test_runserver_addrport(self):
self.cmd.handle(addrport="[2001:0db8:1234:5678::9]:7000")
self.assertServerSettings('2001:0db8:1234:5678::9', '7000', ipv6=True, raw_ipv6=True)

# Hostname
def test_runner_hostname(self):
self.cmd.handle(addrport="localhost:8000")
self.assertServerSettings('localhost', '8000')

self.cmd.handle(addrport="test.domain.local:7000")
self.assertServerSettings('test.domain.local', '7000')

@unittest.skipUnless(socket.has_ipv6, 'markdown is installed')
def test_runner_hostname_ipv6(self):
self.cmd.handle(addrport="test.domain.local:7000", use_ipv6=True)
self.assertServerSettings('test.domain.local', '7000', ipv6=True)

# Potentially ambiguous

def test_runner_ambiguous(self):
# Only 4 characters, all of which could be in an ipv6 address
self.cmd.handle(addrport="beef:7654")
self.assertServerSettings('beef', '7654')
Expand Down

0 comments on commit 154438e

Please sign in to comment.