File tree 2 files changed +29
-24
lines changed
2 files changed +29
-24
lines changed Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import collections
4
+ import json
5
+
6
+ import pytest
7
+
1
8
pytest_plugins = 'pytester'
9
+
10
+
11
+ @pytest .fixture (name = 'cookiecutter_template' )
12
+ def fixture_cookiecutter_template (tmpdir ):
13
+ template = tmpdir .ensure ('cookiecutter-template' , dir = True )
14
+
15
+ template_config = collections .OrderedDict ([
16
+ ('repo_name' , 'foobar' ),
17
+ ('short_description' , 'Test Project' ),
18
+ ])
19
+ template .join ('cookiecutter.json' ).write (json .dumps (template_config ))
20
+
21
+ template_readme = '\n ' .join ([
22
+ '{{cookiecutter.repo_name}}' ,
23
+ '{% for _ in cookiecutter.repo_name %}={% endfor %}' ,
24
+ '{{cookiecutter.short_description}}' ,
25
+ ])
26
+
27
+ repo = template .ensure ('{{cookiecutter.repo_name}}' , dir = True )
28
+ repo .join ('README.rst' ).write (template_readme )
29
+
30
+ return template
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
3
3
import json
4
- import collections
5
-
6
4
import pytest
7
5
8
6
@@ -30,28 +28,6 @@ def test_valid_fixture(cookies):
30
28
assert result .ret == 0
31
29
32
30
33
- @pytest .fixture
34
- def cookiecutter_template (tmpdir ):
35
- template = tmpdir .ensure ('cookiecutter-template' , dir = True )
36
-
37
- template_config = collections .OrderedDict ([
38
- ('repo_name' , 'foobar' ),
39
- ('short_description' , 'Test Project' ),
40
- ])
41
- template .join ('cookiecutter.json' ).write (json .dumps (template_config ))
42
-
43
- template_readme = '\n ' .join ([
44
- '{{cookiecutter.repo_name}}' ,
45
- '{% for _ in cookiecutter.repo_name %}={% endfor %}' ,
46
- '{{cookiecutter.short_description}}' ,
47
- ])
48
-
49
- repo = template .ensure ('{{cookiecutter.repo_name}}' , dir = True )
50
- repo .join ('README.rst' ).write (template_readme )
51
-
52
- return template
53
-
54
-
55
31
def test_cookies_bake_with_template_kwarg (testdir , cookiecutter_template ):
56
32
"""bake accepts a template kwarg."""
57
33
testdir .makepyfile ("""
You can’t perform that action at this time.
0 commit comments