Esempio n. 1
0
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)
Esempio n. 2
0
    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
Esempio n. 3
0
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)
Esempio n. 4
0
    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
Esempio n. 5
0
    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
Esempio n. 6
0
    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
Esempio n. 7
0
    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
Esempio n. 8
0
    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
Esempio n. 9
0
    def __context__(self):
        with attest.tempdir() as path:
            self.path = path
            cache.init(self.path)

        yield
Esempio n. 10
0
    def __context__(self):
        with attest.tempdir() as path:
            self.path = path
            cache.init(self.path)

        yield