Mercurial > piecrust2
comparison tests/conftest.py @ 466:456db44dcc53
bake: Pass the config variants and values from the CLI to the baker.
TODO: add support for that for the processor pipeline.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 11 Jul 2015 23:51:02 -0700 |
parents | c0700c6d9545 |
children | 95b77239c3b7 |
comparison
equal
deleted
inserted
replaced
465:b6e797463798 | 466:456db44dcc53 |
---|---|
5 import os.path | 5 import os.path |
6 import logging | 6 import logging |
7 import pytest | 7 import pytest |
8 import yaml | 8 import yaml |
9 import colorama | 9 import colorama |
10 from piecrust.app import apply_variant_and_values | |
10 from piecrust.configuration import merge_dicts | 11 from piecrust.configuration import merge_dicts |
11 from .mockutil import mock_fs, mock_fs_scope | 12 from .mockutil import mock_fs, mock_fs_scope |
12 | 13 |
13 | 14 |
14 def pytest_runtest_setup(item): | 15 def pytest_runtest_setup(item): |
172 | 173 |
173 from piecrust.baking.baker import Baker | 174 from piecrust.baking.baker import Baker |
174 with mock_fs_scope(fs): | 175 with mock_fs_scope(fs): |
175 out_dir = fs.path('kitchen/_counter') | 176 out_dir = fs.path('kitchen/_counter') |
176 app = fs.getApp() | 177 app = fs.getApp() |
177 baker = Baker(app, out_dir) | 178 |
179 variant = self.spec.get('config_variant') | |
180 values = self.spec.get('config_values') | |
181 if values is not None: | |
182 values = list(values.items()) | |
183 apply_variant_and_values(app, variant, values) | |
184 | |
185 baker = Baker(app, out_dir, | |
186 applied_config_variant=variant, | |
187 applied_config_values=values) | |
178 record = baker.bake() | 188 record = baker.bake() |
179 | 189 |
180 if not record.success: | 190 if not record.success: |
181 errors = [] | 191 errors = [] |
182 for e in record.entries: | 192 for e in record.entries: |