Changeset 5711

Show
Ignore:
Timestamp:
07/05/10 23:53:51 (3 years ago)
Author:
kosma
Message:

test_models.py: fix regression introduced in r5710 (avoid dst=127.0.0.1 in non-Windows because it hits looback interface)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • umpa/branches/link-layer-integration/tests/a_unit/test_extensions/test_models.py

    r5710 r5711  
    3232 
    3333import py.test 
     34 
     35if os.name == 'nt': 
     36    # Windows doesn't have a loopback interface and wants us to send 
     37    # from a valid local address 
     38    revhosts_ip = '127.0.0.1' 
     39else: 
     40    # other OSes have a loopback interface (which we don't want to use here) 
     41    # and allow us to use any IP we like 
     42    revhosts_ip = '1.2.3.4' 
    3443 
    3544class SniffThread(threading.Thread): 
     
    7786        try: 
    7887            assert pkt[0].ip.src == "8.8.8.8" 
    79             assert pkt[0].ip.dst == "127.0.0.1" 
    80             assert pkt[1].ip.src == "127.0.0.1" 
     88            assert pkt[0].ip.dst == revhosts_ip 
     89            assert pkt[1].ip.src == revhosts_ip 
    8190            assert pkt[1].ip.dst == "8.8.8.8" 
    8291        except Exception, e: 
     
    166175        queue = Queue.Queue() 
    167176 
    168         th = SendPacket(umit.umpa.Packet(IP(src="8.8.8.8", dst="127.0.0.1"), 
     177        th = SendPacket(umit.umpa.Packet(IP(src="8.8.8.8", dst=revhosts_ip), 
    169178                                         UDP(srcport=80, dstport=0))) 
    170179        th.start()