コード例 #1
0
ファイル: testprocesses.py プロジェクト: pombredanne/rox-lib
 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'
コード例 #2
0
ファイル: testprocesses.py プロジェクト: boube/minino
	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'
コード例 #3
0
ファイル: testprocesses.py プロジェクト: boube/minino
	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)
コード例 #4
0
ファイル: testprocesses.py プロジェクト: boube/minino
	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'
コード例 #5
0
ファイル: testprocesses.py プロジェクト: pombredanne/rox-lib
 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)
コード例 #6
0
ファイル: testprocesses.py プロジェクト: pombredanne/rox-lib
 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'
コード例 #7
0
ファイル: testprocesses.py プロジェクト: boube/minino
	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'
コード例 #8
0
ファイル: testprocesses.py プロジェクト: pombredanne/rox-lib
 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'
コード例 #9
0
ファイル: testprocesses.py プロジェクト: boube/minino
	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'
コード例 #10
0
ファイル: testprocesses.py プロジェクト: pombredanne/rox-lib
    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'