1
|
|
|
import os |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
def test_recipe_plugin_activation(basicApp): |
5
|
|
|
plugin = basicApp.plugins.get("RecipePlugin") |
6
|
|
|
assert plugin is not None |
7
|
|
|
assert plugin.active is True |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
def test_recipe_registration(basicApp): |
11
|
|
|
basicApp.plugins.get("RecipePlugin") |
12
|
|
|
test_recipe = basicApp.recipes.get("test_recipe") |
13
|
|
|
assert test_recipe is not None |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
def test_recipe_build(basicApp, tmpdir): |
17
|
|
|
basicApp.plugins.get("RecipePlugin") |
18
|
|
|
test_recipe = basicApp.recipes.get("test_recipe") |
19
|
|
|
|
20
|
|
|
output_folder = str(tmpdir.mkdir("output")) |
21
|
|
|
output_data = test_recipe.build(output_folder, no_input=True) |
22
|
|
|
|
23
|
|
|
assert output_data == os.path.join(output_folder, "My Package") |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
def test_recipe_jinja(basicApp, tmpdir): |
27
|
|
|
basicApp.plugins.get("RecipePlugin") |
28
|
|
|
test_recipe = basicApp.recipes.get("test_recipe") |
29
|
|
|
|
30
|
|
|
output_folder = str(tmpdir.mkdir("output")) |
31
|
|
|
test_recipe.build(output_folder, no_input=True) |
32
|
|
|
assert "My Name" in open(os.path.join(output_folder, "My Package/README.rst")).read() |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
def test_rescipe_get(basicApp): |
36
|
|
|
plugin = basicApp.plugins.get("RecipePlugin") |
37
|
|
|
plugin.recipes.get("test_recipe") |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
def test_recipe_unregister(basicApp): |
41
|
|
|
plugin = basicApp.plugins.get("RecipePlugin") |
42
|
|
|
recipe = plugin.recipes.get("test_recipe") |
43
|
|
|
plugin.recipes.unregister(recipe.name) |
44
|
|
|
recipe = plugin.recipes.get("test_recipe") |
45
|
|
|
assert recipe is None |
46
|
|
|
|