def test_write_options():
    replace_builtins()
    try:
        write_options(SAMPLE_OPTIONS, "/mysql_defaults.conf")
        stream = open("/mysql_defaults.conf")
        assert_equals(parse_options(stream), SAMPLE_OPTIONS)
    finally:
        restore_builtins()
    ok_(not os.path.exists("/mysql_defaults.conf"), "Fake filesystem failure (FFF)")
Exemple #2
0
def test_write_options():
    replace_builtins()
    try:
        write_options(SAMPLE_OPTIONS, '/mysql_defaults.conf')
        stream = open('/mysql_defaults.conf')
        assert_equals(parse_options(stream), SAMPLE_OPTIONS)
    finally:
        restore_builtins()
    ok_(not os.path.exists('/mysql_defaults.conf'),
        "Fake filesystem failure (FFF)")
Exemple #3
0
    def test_patching(self):
        storage.replace_builtins()
        try:
            self.assertEqual(builtins.file, storage.file)
            self.assertEqual(builtins.open, storage.open)
        finally:
            storage.restore_builtins()

        self.assertEqual(builtins.file, storage.original_file)
        self.assertNotEqual(storage.original_file, storage.file)
        self.assertEqual(builtins.open, storage.original_open)
        self.assertNotEqual(storage.original_open, storage.open)