'Test that we discard files properly'

def test_discard(self):

    self.site.external_manager.register_processor(DiscardingProcessor)
    self.site.external_manager.register_optimizer(SourceOptimizer)
    self.site.build()
    self.assertEqual(0, len(TestExternal.runs))
    self.assertFileDoesNotExist(os.path.join(self.site.build_path, 'static', 'test.dst'))
    self.assertFileDoesNotExist(os.path.join(self.site.build_path, 'static', 'test.src'))
    for static in self.site.static():
        if (static.src_filename == self.dummy_static):
            self.assertTrue(static.discarded)
