class WriterTestCase(unittest.TestCase): def setUp(self): self.config = Config(working_dir) self.writer = Writer(self.config) def test_run(self): shutil.rmtree(build_dir, True) assert not os.path.isdir(build_dir) self.writer.run() assert os.path.exists(fragment_abspath) assert os.path.exists(another_abspath) def test_write_fragment(self): shutil.rmtree(build_dir, True) assert not os.path.isdir(build_dir) fragment = self.writer.parser.get_fragment(source_abspath) fragment_abspath = self.writer.path.get_fragment_abspath(source_abspath) self.writer.write_fragment(fragment, fragment_abspath) assert os.path.exists(fragment_abspath) # Do it again so both fragments will exist for loader test another_fragment = self.writer.parser.get_fragment(another_file) another_fragment_abspath = self.writer.path.get_fragment_abspath(another_file) self.writer.write_fragment(another_fragment, another_fragment_abspath) assert os.path.exists(another_fragment_abspath) def test_make_fragment_dir(self): shutil.rmtree(build_dir, True) assert not os.path.isdir(build_dir) fragment_abspath = self.writer.path.get_fragment_abspath(source_abspath) self.writer.make_fragment_dir(fragment_abspath) fragment_dir = os.path.dirname(fragment_abspath) assert os.path.isdir(fragment_dir)