def test_rewrite(self): with putils.working_dir(self.test_dir): putils.write2file('a.html', "A!") putils.write2file('a.html', "B!") with codecs.open('a.html', 'r') as fin: assert fin.read() == "B!"
def _gen_single(self, relpath): if relpath.rpartition('/')[2][0] != "_": tmpl = self.env.get_template(relpath) content = tmpl.render() self.logger("Regen file {}".format(pjoin(self.target, relpath))) putils.write2file(pjoin(self.target, relpath), content)
def test_unicode(self): with putils.working_dir(self.test_dir): putils.write2file('a.html', u"привет") with codecs.open('a.html', 'r') as fin: assert fin.read() == "привет"