Ejemplo n.º 1
0
 def test_rwlocalfile3(self):
     """use existing file"""
     path = self.fixture_file('remotefile2')
     self.assertTrue(os.path.exists(path))
     f = RWLocalFile(path, wb_path='/source/prj/pkg/remotefile2',
                     append=True)
     f.write(' testcase\n')
     f.flush()
     with open(path, 'r') as fobj:
         exp = 'yet another\nsimple\nfile\n testcase\n'
         self.assertEqual(fobj.read(), exp)
     f.write_back()
     f.close()
Ejemplo n.º 2
0
 def test_rwlocalfile3(self):
     """use existing file"""
     path = self.fixture_file('remotefile2')
     self.assertTrue(os.path.exists(path))
     f = RWLocalFile(path,
                     wb_path='/source/prj/pkg/remotefile2',
                     append=True)
     f.write(' testcase\n')
     f.flush()
     with open(path, 'r') as fobj:
         exp = 'yet another\nsimple\nfile\n testcase\n'
         self.assertEqual(fobj.read(), exp)
     f.write_back()
     f.close()
Ejemplo n.º 3
0
 def test_rwlocalfile1(self):
     """test simple read write (file does not exist)"""
     path = self.fixture_file('doesnotexist')
     self.assertFalse(os.path.exists(path))
     f = RWLocalFile(path, wb_path='/foo/bar')
     f.write('some data')
     f.flush()
     self.assertTrue(os.path.isfile(path))
     with open(path, 'r') as fobj:
         self.assertEqual(fobj.read(), 'some data')
     f.seek(0, os.SEEK_SET)
     self.assertEqual(f.read(), 'some data')
     f.write_back(foo='bar')
     f.close()
Ejemplo n.º 4
0
 def test_rwlocalfile1(self):
     """test simple read write (file does not exist)"""
     path = self.fixture_file('doesnotexist')
     self.assertFalse(os.path.exists(path))
     f = RWLocalFile(path, wb_path='/foo/bar')
     f.write('some data')
     f.flush()
     self.assertTrue(os.path.isfile(path))
     with open(path, 'r') as fobj:
         self.assertEqual(fobj.read(), 'some data')
     f.seek(0, os.SEEK_SET)
     self.assertEqual(f.read(), 'some data')
     f.write_back(foo='bar')
     f.close()