Skip to content

Commit 43c0c7c

Browse files
authored
Simplifiied example by removing functions
1 parent 3531461 commit 43c0c7c

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

cookiecutter/pytest-for-cookiecutter.md

+7-17
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ TEMPLATE_DIRECTORY = str(pathlib.Path(__file__).parent.parent)
1616

1717

1818
def test_static_and_templates(tmpdir):
19-
generate(
20-
tmpdir,
21-
{
19+
cookiecutter(
20+
template=TEMPLATE_DIRECTORY,
21+
output_dir=str(tmpdir),
22+
no_input=True,
23+
extra_context={
2224
"plugin_name": "foo",
2325
"description": "blah",
2426
"include_templates_directory": "y",
@@ -41,22 +43,10 @@ def test_static_and_templates(tmpdir):
4143
"datasette-foo/tests",
4244
"datasette-foo/tests/test_foo.py",
4345
}
46+
setup_py = (tmpdir / "datasette-foo" / "setup.py").read_text("utf-8")
4447
assert (
4548
'package_data={\n "datasette_foo": ["static/*", "templates/*"]\n }'
46-
) in read_setup_py(tmpdir)
47-
48-
49-
def generate(directory, context):
50-
cookiecutter(
51-
template=TEMPLATE_DIRECTORY,
52-
output_dir=str(directory),
53-
no_input=True,
54-
extra_context=context,
55-
)
56-
57-
58-
def read_setup_py(tmpdir):
59-
return (tmpdir / "datasette-foo" / "setup.py").read_text("utf-8")
49+
) in setup_py
6050

6151

6252
def paths(directory):

0 commit comments

Comments
 (0)