def tempdir(): with attest.tempdir() as d: assert path.isdir(d) assert os.listdir(d) == [] open(path.join(d, 'tempfile'), 'w').close() assert os.listdir(d) == ['tempfile'] assert not path.exists(d)
def __context__(self): with attest.tempdir() as path: self.path = path os.chdir(self.path) os.mkdir('content/') os.mkdir('layouts/') with open('layouts/main.html', 'w') as fp: fp.write('{{ env.entrylist[0].content }}\n') with open('layouts/atom.xml', 'w') as fp: fp.write( "{% for entry in env.entrylist %}\n{{ entry.content ~ '\n' }}\n{% endfor %}" ) self.conf = core.Configuration(conf) self.env = core.Environment({ 'options': options, 'globals': utils.Struct() }) self.conf['filters'] = ['Markdown', 'h1'] self.conf['views'] = { '/:year/:slug/': { 'view': 'entry' }, '/atom.xml': { 'view': 'Atom', 'filters': ['h2', 'summarize+2'] } } yield
def __context__(self): with attest.tempdir() as path: self.path = path os.chdir(self.path) os.mkdir('content/') os.mkdir('layouts/') with open('layouts/main.html', 'w') as fp: fp.write('{{ env.entrylist[0].content }}\n') self.conf = conf self.env = utils.Struct({'options': options, 'globals': utils.Struct()}) self.conf['filters'] = ['HTML'] self.conf['views'] = {'/:year/:slug/': {'view': 'entry'}} yield
def __context__(self): with attest.tempdir() as path: self.path = path os.chdir(self.path) os.mkdir('content/') os.mkdir('layouts/') with open('layouts/main.html', 'w') as fp: fp.write('{{ env.entrylist[0].content }}\n') self.conf = core.Configuration(conf) self.env = core.Environment({'options': options, 'globals': utils.Struct()}) self.conf['filters'] = ['HTML'] self.conf['views'] = {'/:year/:slug/': {'view': 'entry'}} yield
def __context__(self): with attest.tempdir() as path: self.path = path os.chdir(self.path) os.mkdir("content/") os.mkdir("layouts/") with open("layouts/main.html", "w") as fp: fp.write("{{ env.entrylist[0].content }}\n") self.conf = core.Configuration(conf) self.env = core.Environment({"options": options, "globals": utils.Struct()}) self.conf["filters"] = ["HTML"] self.conf["views"] = {"/:year/:slug/": {"view": "entry"}} yield
def __context__(self): with attest.tempdir() as path: self.path = path os.chdir(self.path) os.mkdir('content/') os.mkdir('layouts/') with open('layouts/main.html', 'w') as fp: fp.write('{{ env.entrylist[0].content }}\n') with open('layouts/atom.xml', 'w') as fp: fp.write("{% for entry in env.entrylist %}\n{{ entry.content ~ '\n' }}\n{% endfor %}") self.conf = conf self.env = utils.Struct({'options': options, 'globals': utils.Struct()}) self.conf['filters'] = ['Markdown', 'h1'] self.conf['views'] = {'/:year/:slug/': {'view': 'entry'}, '/atom.xml': {'view': 'Atom', 'filters': ['h2', 'summarize+2']}} yield
def __context__(self): with attest.tempdir() as path: self.path = path os.chdir(self.path) os.mkdir("content/") os.mkdir("layouts/") with open("layouts/main.html", "w") as fp: fp.write("{{ env.entrylist[0].content }}\n") with open("layouts/atom.xml", "w") as fp: fp.write("{% for entry in env.entrylist %}\n{{ entry.content ~ '\n' }}\n{% endfor %}") self.conf = core.Configuration(conf) self.env = core.Environment({"options": options, "globals": utils.Struct()}) self.conf["filters"] = ["Markdown", "h1"] self.conf["views"] = { "/:year/:slug/": {"view": "entry"}, "/atom.xml": {"view": "Atom", "filters": ["h2", "summarize+2"]}, } yield
def __context__(self): with attest.tempdir() as path: self.path = path cache.init(self.path) yield