Exemplo n.º 1
0
 def testRWfile(self):
     tmp_file = processes._Tmp()
     tmp_file.write('Hello World')
     src = processes._Tmp()
     src.write('123')
     src.seek(0)
     tmp_file.seek(0)
     tmp_file.truncate(0)
     pipe_through_command('cat', src, tmp_file)
     tmp_file.seek(0)
     assert tmp_file.read() == '123'
Exemplo n.º 2
0
	def testRWfile(self):
		tmp_file = processes._Tmp()
		tmp_file.write('Hello World')
		src = processes._Tmp()
		src.write('123')
		src.seek(0)
		tmp_file.seek(0)
		tmp_file.truncate(0)
		pipe_through_command('cat', src, tmp_file)
		tmp_file.seek(0)
		assert tmp_file.read() == '123'
Exemplo n.º 3
0
	def testDelTmp(self):
		tmp_file = processes._Tmp()
		name = tmp_file.name
		assert os.path.exists(name)
		tmp_file = None
		gc.collect()
		assert not os.path.exists(name)
Exemplo n.º 4
0
	def testWriteFileno(self):
		tmp_file = processes._Tmp()
		tmp_file.seek(0)
		tmp_file.truncate(0)
		pipe_through_command('echo Foo', None, tmp_file)
		tmp_file.seek(0)
		assert tmp_file.read() == 'Foo\n'
Exemplo n.º 5
0
 def testDelTmp(self):
     tmp_file = processes._Tmp()
     name = tmp_file.name
     assert os.path.exists(name)
     tmp_file = None
     gc.collect()
     assert not os.path.exists(name)
Exemplo n.º 6
0
 def testWriteFileno(self):
     tmp_file = processes._Tmp()
     tmp_file.seek(0)
     tmp_file.truncate(0)
     pipe_through_command('echo Foo', None, tmp_file)
     tmp_file.seek(0)
     assert tmp_file.read() == 'Foo\n'
Exemplo n.º 7
0
	def testStringIO(self):
		a = StringIO()
		pipe_through_command('echo Hello', None, a)
		tmp_file = processes._Tmp()
		tmp_file.write('Hello World')
		tmp_file.seek(1)
		pipe_through_command('cat', tmp_file, a)
		assert a.getvalue() == 'Hello\nHello World'
Exemplo n.º 8
0
 def testStringIO(self):
     a = StringIO()
     pipe_through_command('echo Hello', None, a)
     tmp_file = processes._Tmp()
     tmp_file.write('Hello World')
     tmp_file.seek(1)
     pipe_through_command('cat', tmp_file, a)
     assert a.getvalue() == 'Hello\nHello World'
Exemplo n.º 9
0
	def testTmp(self):
		tmp_file = processes._Tmp()
		tmp_file.write('Hello')
		print >>tmp_file, ' ',
		tmp_file.flush()
		os.write(tmp_file.fileno(), 'World')

		tmp_file.seek(0)
		assert tmp_file.read() == 'Hello World'
Exemplo n.º 10
0
    def testTmp(self):
        tmp_file = processes._Tmp()
        tmp_file.write('Hello')
        print >> tmp_file, ' ',
        tmp_file.flush()
        os.write(tmp_file.fileno(), 'World')

        tmp_file.seek(0)
        assert tmp_file.read() == 'Hello World'