Example #1
0
 def test_rwlocalfile4(self):
     """test direct write_back (no previous read, write etc.)"""
     path = self.fixture_file('remotefile2')
     f = RWLocalFile(path, wb_path='/source/prj/pkg/remotefile2',
                     append=True)
     f.write_back(force=True)
     f.close()
Example #2
0
 def _commit_files(self, cstate, send_filenames):
     for filename in send_filenames:
         st = self.status(filename)
         wc_filename = os.path.join(self.path, filename)
         path = "/source/%s/%s/%s" % (self.project, self.name, filename)
         lfile = RWLocalFile(wc_filename, wb_path=path, append=True)
         self.notifier.transfer('upload', filename)
         lfile.write_back(force=True, rev='repository', apiurl=self.apiurl)
         cstate.processed(filename, ' ')
         commit_filename = os.path.join(cstate.location, filename)
         # move wcfile into transaction dir
         os.rename(lfile.path, commit_filename)
         self.notifier.processed(filename, ' ', st)
Example #3
0
 def _commit_files(self, cstate, send_filenames):
     for filename in send_filenames:
         st = self.status(filename)
         wc_filename = os.path.join(self.path, filename)
         path = "/source/%s/%s/%s" % (self.project, self.name, filename)
         lfile = RWLocalFile(wc_filename, wb_path=path, append=True)
         self.notifier.transfer('upload', filename)
         lfile.write_back(force=True, rev='repository', apiurl=self.apiurl)
         cstate.processed(filename, ' ')
         commit_filename = os.path.join(cstate.location, filename)
         # move wcfile into transaction dir
         os.rename(lfile.path, commit_filename)
         self.notifier.processed(filename, ' ', st)
Example #4
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()
Example #5
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()
Example #6
0
 def test_rwlocalfile4(self):
     """test direct write_back (no previous read, write etc.)"""
     path = self.fixture_file('remotefile2')
     f = RWLocalFile(path,
                     wb_path='/source/prj/pkg/remotefile2',
                     append=True)
     f.write_back(force=True)
     f.close()
Example #7
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()
Example #8
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()