def test_paranoid_append_framing(self):
        with self.DurableFile('w') as fp:
            fn = fp.name

        test_string_1 = "hello world"
        test_string_2 = "ahoy ahoy, bonjour"

        RecordWriter.append(fn, test_string_1)
        RecordWriter.append(fn, test_string_2)

        with open(fn) as fpr:
            rr = RecordReader(fpr)
            assert rr.read() == test_string_1
            assert rr.read() == test_string_2

        os.remove(fn)
Beispiel #2
0
  def test_paranoid_append_framing(self):
    with self.DurableFile('w') as fp:
      fn = fp.name

    test_string_1 = "hello world"
    test_string_2 = "ahoy ahoy, bonjour"

    RecordWriter.append(fn, test_string_1)
    RecordWriter.append(fn, test_string_2)

    with open(fn) as fpr:
      rr = RecordReader(fpr)
      assert rr.read() == test_string_1
      assert rr.read() == test_string_2

    os.remove(fn)
 def test_append_fails_on_inaccessible_file(self):
     with RecordioTestBase.EphemeralFile('w') as fp:
         os.fchmod(fp.fileno(), 000)
         with pytest.raises(IOError):
             RecordWriter.append(fp.name, 'hello world!')
 def test_append_fails_on_nonexistent_file(self):
     fn = tempfile.mktemp()
     assert RecordWriter.append(fn, 'hello world!') == False
Beispiel #5
0
def test_paranoid_append_returns_false_on_nonexistent_file():
    fn = tempfile.mktemp()
    assert RecordWriter.append(fn, 'hello world!') == False
Beispiel #6
0
 def test_append_fails_on_inaccessible_file(self):
   with RecordioTestBase.EphemeralFile('w') as fp:
     os.fchmod(fp.fileno(), 000)
     with pytest.raises(IOError):
       RecordWriter.append(fp.name, 'hello world!')
Beispiel #7
0
 def test_append_fails_on_nonexistent_file(self):
   fn = tempfile.mktemp()
   assert RecordWriter.append(fn, 'hello world!') == False
Beispiel #8
0
def test_paranoid_append_returns_false_on_nonexistent_file():
  fn = tempfile.mktemp()
  assert RecordWriter.append(fn, 'hello world!') == False