def test_process_file_triggers_pre_composition(self, signals): config = Configuration() site = self.factory.make_site() director = Director(config, site, []) marker = os.path.join(site.path, 'marker.txt') open(marker, 'w').close() director.process_file(marker) signals.pre_composition.send.assert_called_once_with(director)
def test_process_file_ignores_templates(self): config = Configuration() site = self.factory.make_site() default = os.path.join(site.path, 'template.html') open(default, 'w').close() config.outdir = os.path.join(site.path, 'outdir') os.mkdir(config.outdir) director = Director(config, site, []) director.process_file(default) default_output = os.path.join(config.outdir, 'template.html') self.assertFalse(os.path.exists(default_output))
def test_process_file_ignores_files_already_in_output(self): # This condition is checked because the output directory can be within # the source (e.g., the default of storing results in 'output'). If # the watcher is watching for any changes in site source, then # processing files in the output directory could lead the watcher into # an infinite loop. config = Configuration() site = self.factory.make_site() config.outdir = os.path.join(site.path, 'outdir') os.mkdir(config.outdir) marker = os.path.join(config.outdir, 'marker.md') open(marker, 'w').close() director = Director(config, site, []) director.process_file(marker) marker_output = os.path.join(config.outdir, 'marker.html') self.assertFalse(os.path.exists(marker_output))