def test_provided_templates(self): """Run all provided templates at least once""" for label, directory in [("makotemplate", "mako"), ("mustache", "mustache")]: template_dir = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "templates", directory) templates = glob.glob(os.path.join(template_dir, "*.tpl")) template_labels = [ os.path.basename(f).split(".")[0] for f in templates ] for tpl in template_labels: w("""cat <<EOF > .gitchangelog.rc output_engine = %s(%r) EOF """ % (label, tpl)) out, err, errlvl = cmd('$tprog') self.assertEqual(errlvl, 0, msg="Should not fail on %s(%r) " % (label, tpl) + "Current stderr:\n%s" % indent(err))
def test_provided_config_file(self): """Check provided reference with older name for perfect same result.""" config_dir = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..") configs = glob.glob(os.path.join(config_dir, "gitchangelog.rc.reference.v*")) for config in configs: out, err, errlvl = cmd( 'GITCHANGELOG_CONFIG_FILENAME="%s" $tprog' % config) self.assertEqual( errlvl, 0, msg="Should not fail with config %r " % (config, ) + "Current stderr:\n%s" % indent(err)) self.assertEqual( out, self.REFERENCE, msg="Mako output should match our reference output... " "diff of changelogs:\n%s" % '\n'.join(difflib.unified_diff( self.REFERENCE.split("\n"), out.split("\n"), lineterm="")))
def test_provided_config_file(self): """Check provided reference with older name for perfect same result.""" config_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..") configs = glob.glob( os.path.join(config_dir, "gitchangelog.rc.reference.v*")) for config in configs: out, err, errlvl = cmd('GITCHANGELOG_CONFIG_FILENAME="%s" $tprog' % config) self.assertEqual(errlvl, 0, msg="Should not fail with config %r " % (config, ) + "Current stderr:\n%s" % indent(err)) self.assertEqual( out, self.REFERENCE, msg="Mako output should match our reference output... " "diff of changelogs:\n%s" % '\n'.join( difflib.unified_diff(self.REFERENCE.split("\n"), out.split("\n"), lineterm="")))
def test_provided_templates(self): """Run all provided templates at least once""" for label, directory in [("makotemplate", "mako"), ("mustache", "mustache")]: template_dir = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "templates", directory) templates = glob.glob(os.path.join(template_dir, "*.tpl")) template_labels = [os.path.basename(f).split(".")[0] for f in templates] for tpl in template_labels: w("""cat <<EOF > .gitchangelog.rc output_engine = %s(%r) EOF """ % (label, tpl)) out, err, errlvl = cmd('$tprog') self.assertEqual( errlvl, 0, msg="Should not fail on %s(%r) " % (label, tpl) + "Current stderr:\n%s" % indent(err))