[svn r63171] avoid random writes to tempdir
--HG-- branch : trunk
This commit is contained in:
parent
074788e580
commit
a2e7b1433e
|
@ -1,5 +1,6 @@
|
||||||
import os, random
|
import os, random
|
||||||
from pygreen.pipelayer import PipeLayer, pipe_over_udp, PipeOverUdp
|
from pygreen.pipelayer import PipeLayer, pipe_over_udp, PipeOverUdp
|
||||||
|
import py
|
||||||
|
|
||||||
def test_simple():
|
def test_simple():
|
||||||
data1 = os.urandom(1000)
|
data1 = os.urandom(1000)
|
||||||
|
@ -169,6 +170,11 @@ def test_pipe_over_udp():
|
||||||
import thread
|
import thread
|
||||||
s1, s2 = udpsockpair()
|
s1, s2 = udpsockpair()
|
||||||
|
|
||||||
|
tmp = py.test.ensuretemp("pipeoverudp")
|
||||||
|
p = py.path.local(__file__)
|
||||||
|
p.copy(tmp.join(p.basename))
|
||||||
|
old = tmp.chdir()
|
||||||
|
try:
|
||||||
fd1 = os.open(__file__, os.O_RDONLY)
|
fd1 = os.open(__file__, os.O_RDONLY)
|
||||||
fd2 = os.open('test_pipelayer.py~copy', os.O_WRONLY|os.O_CREAT|os.O_TRUNC)
|
fd2 = os.open('test_pipelayer.py~copy', os.O_WRONLY|os.O_CREAT|os.O_TRUNC)
|
||||||
|
|
||||||
|
@ -184,6 +190,8 @@ def test_pipe_over_udp():
|
||||||
f.close()
|
f.close()
|
||||||
assert data1 == data2
|
assert data1 == data2
|
||||||
os.unlink('test_pipelayer.py~copy')
|
os.unlink('test_pipelayer.py~copy')
|
||||||
|
finally:
|
||||||
|
old.chdir()
|
||||||
|
|
||||||
def test_PipeOverUdp():
|
def test_PipeOverUdp():
|
||||||
s1, s2 = udpsockpair()
|
s1, s2 = udpsockpair()
|
||||||
|
|
Loading…
Reference in New Issue