Mercurial > piecrust2
comparison piecrust/sources/prose.py @ 394:65db6df28120
tests: Also mock `open` in Jinja to be able to use templates in bake tests.
This also required raising the proper exception in the mock function. We are
now raising `IOError` and set the `errno` attribute on it.
| author | Ludovic Chabant <ludovic@chabant.com> |
|---|---|
| date | Sun, 17 May 2015 15:28:00 -0700 |
| parents | 4b1019bb2533 |
| children | 4850f8c21b6e |
comparison
equal
deleted
inserted
replaced
| 393:89c1e2a91468 | 394:65db6df28120 |
|---|---|
| 23 c = copy.deepcopy(self.config_recipe) | 23 c = copy.deepcopy(self.config_recipe) |
| 24 if c.get('title') == '%first_line%' and mode != MODE_CREATING: | 24 if c.get('title') == '%first_line%' and mode != MODE_CREATING: |
| 25 path = os.path.join(self.fs_endpoint_path, rel_path) | 25 path = os.path.join(self.fs_endpoint_path, rel_path) |
| 26 try: | 26 try: |
| 27 c['title'] = get_first_line(path) | 27 c['title'] = get_first_line(path) |
| 28 except OSError: | 28 except IOError: |
| 29 if mode == MODE_PARSING: | 29 if mode == MODE_PARSING: |
| 30 raise | 30 raise |
| 31 return c | 31 return c |
| 32 | 32 |
| 33 | 33 |
