MCPcopy
hub / github.com/lektor/lektor / scratch_project_data

Function scratch_project_data

tests/conftest.py:95–139  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

93
94@pytest.fixture(scope="function")
95def scratch_project_data(tmpdir):
96 base = tmpdir.mkdir("scratch-proj")
97 lektorfile_text = textwrap.dedent(
98 """
99 [project]
100 name = Scratch
101
102 [alternatives.en]
103 primary = yes
104 [alternatives.de]
105 url_prefix = /de/
106 """
107 )
108 base.join("Scratch.lektorproject").write_text(lektorfile_text, "utf8", ensure=True)
109 content_text = textwrap.dedent(
110 """
111 _model: page
112 ---
113 title: Index
114 ---
115 body: *Hello World!*
116 """
117 )
118 base.join("content", "contents.lr").write_text(content_text, "utf8", ensure=True)
119 template_text = textwrap.dedent(
120 """
121 <h1>{{ this.title }}</h1>
122 {{ this.body }}
123 """
124 )
125 base.join("templates", "page.html").write_text(template_text, "utf8", ensure=True)
126 model_text = textwrap.dedent(
127 """
128 [model]
129 label = {{ this.title }}
130
131 [fields.title]
132 type = string
133 [fields.body]
134 type = markdown
135 """
136 )
137 base.join("models", "page.ini").write_text(model_text, "utf8", ensure=True)
138
139 return base
140
141
142@pytest.fixture(scope="function")

Callers

nothing calls this directly

Calls 1

mkdirMethod · 0.80

Tested by

no test coverage detected