示例#1
0
 def test_rwremotefile3(self):
     """write and seek"""
     f = RWRemoteFile('/source/project/package/fname2')
     f.write('ple\nfile\n')
     f.seek(0, os.SEEK_SET)
     f.write('yet another\nsim')
     f.close(foo='bar')
示例#2
0
 def test_rwremotefile3(self):
     """write and seek"""
     f = RWRemoteFile('/source/project/package/fname2')
     f.write('ple\nfile\n')
     f.seek(0, os.SEEK_SET)
     f.write('yet another\nsim')
     f.close(foo='bar')
示例#3
0
 def test_rwremotefile6(self):
     """write to file (tmpfile)"""
     f = RWRemoteFile('/source/project/package/fname2', use_tmp=True)
     f.write('yet another\nsim')
     self.assertTrue(os.path.exists(f._fobj.name))
     f.write('ple\nfile\n')
     f.close()
     self.assertFalse(os.path.exists(f._fobj.name))
示例#4
0
 def test_rwremotefile6(self):
     """write to file (tmpfile)"""
     f = RWRemoteFile('/source/project/package/fname2', use_tmp=True)
     f.write('yet another\nsim')
     self.assertTrue(os.path.exists(f._fobj.name))
     f.write('ple\nfile\n')
     f.close()
     self.assertFalse(os.path.exists(f._fobj.name))
示例#5
0
 def test_rwremotefile10(self):
     """read some bytes, write some bytes and call write_to"""
     f = RWRemoteFile('/source/project/package/fname2', append=True)
     self.assertEqual(f.read(3), 'yet')
     self.assertTrue(isinstance(f._fobj, OutputType))
     f.write('01234567')
     sio = StringIO()
     f.write_to(sio, 7)
     self.assertEqual(sio.getvalue(), '\nsimple')
示例#6
0
 def test_rwremotefile7(self):
     """write and seek (tmpfile)"""
     f = RWRemoteFile('/source/project/package/fname2', use_tmp=True)
     f.write('ple\nfile\n')
     self.assertTrue(os.path.exists(f._fobj.name))
     f.seek(0, os.SEEK_SET)
     f.write('yet another\nsim')
     f.close(foo='bar')
     self.assertFalse(os.path.exists(f._fobj.name))
示例#7
0
 def test_rwremotefile10(self):
     """read some bytes, write some bytes and call write_to"""
     f = RWRemoteFile('/source/project/package/fname2', append=True)
     self.assertEqual(f.read(3), 'yet')
     self.assertTrue(isinstance(f._fobj, OutputType))
     f.write('01234567')
     sio = StringIO()
     f.write_to(sio, 7)
     self.assertEqual(sio.getvalue(), '\nsimple')
示例#8
0
 def test_rwremotefile7(self):
     """write and seek (tmpfile)"""
     f = RWRemoteFile('/source/project/package/fname2', use_tmp=True)
     f.write('ple\nfile\n')
     self.assertTrue(os.path.exists(f._fobj.name))
     f.seek(0, os.SEEK_SET)
     f.write('yet another\nsim')
     f.close(foo='bar')
     self.assertFalse(os.path.exists(f._fobj.name))
示例#9
0
 def test_rwremotefile4(self):
     """append to existing file"""
     f = RWRemoteFile('/source/project/package/fname2', append=True)
     # read first line
     self.assertEqual(f.readline(), 'yet another\n')
     # append/overwrite text
     f.write('more complex\n')
     f.write('testcase\n')
     # check that it is a StringIO
     self.assertTrue(isinstance(f._fobj, OutputType))
     f.close()
示例#10
0
 def test_rwremotefile4(self):
     """append to existing file"""
     f = RWRemoteFile('/source/project/package/fname2', append=True)
     # read first line
     self.assertEqual(f.readline(), 'yet another\n')
     # append/overwrite text
     f.write('more complex\n')
     f.write('testcase\n')
     # check that it is a StringIO
     self.assertTrue(isinstance(f._fobj, OutputType))
     f.close()
示例#11
0
 def test_rwremotefile8(self):
     """append to existing file"""
     f = RWRemoteFile('/source/project/package/fname2',
                      tmp_size=15, append=True)
     # read first line
     self.assertEqual(f.readline(), 'yet another\n')
     self.assertTrue(os.path.exists(f._fobj.name))
     # append/overwrite text
     f.write('more complex\n')
     f.write('testcase\n')
     f.close()
     self.assertFalse(os.path.exists(f._fobj.name))
示例#12
0
 def test_rwremotefile8(self):
     """append to existing file"""
     f = RWRemoteFile('/source/project/package/fname2',
                      tmp_size=15,
                      append=True)
     # read first line
     self.assertEqual(f.readline(), 'yet another\n')
     self.assertTrue(os.path.exists(f._fobj.name))
     # append/overwrite text
     f.write('more complex\n')
     f.write('testcase\n')
     f.close()
     self.assertFalse(os.path.exists(f._fobj.name))
示例#13
0
 def test_rwremotefile11(self):
     """write, seek and multiple write backs"""
     f = RWRemoteFile('/source/project/package/fname2',
                      wb_path='/other/path')
     f.write('ple\nfile\n')
     f.seek(0, os.SEEK_SET)
     f.write('yet another\nsim')
     f.write_back(foo='bar')
     # no request is issued because file isn't modified
     f.write_back()
     # force write back
     f.write_back(force=True)
     # no write back is issued
     f.close(foo='bar')
示例#14
0
 def test_rwremotefile11(self):
     """write, seek and multiple write backs"""
     f = RWRemoteFile('/source/project/package/fname2',
                      wb_path='/other/path')
     f.write('ple\nfile\n')
     f.seek(0, os.SEEK_SET)
     f.write('yet another\nsim')
     f.write_back(foo='bar')
     # no request is issued because file isn't modified
     f.write_back()
     # force write back
     f.write_back(force=True)
     # no write back is issued
     f.close(foo='bar')
示例#15
0
 def test_rwremotefile2(self):
     """write to file"""
     f = RWRemoteFile('/source/project/package/fname2')
     f.write('yet another\nsim')
     f.write('ple\nfile\n')
     f.close()
示例#16
0
 def test_rwremotefile2(self):
     """write to file"""
     f = RWRemoteFile('/source/project/package/fname2')
     f.write('yet another\nsim')
     f.write('ple\nfile\n')
     f.close()