Exemple #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)
Exemple #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
Exemple #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)
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #9
0
    def __context__(self):
        with attest.tempdir() as path:
            self.path = path
            cache.init(self.path)

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

        yield