Mercurial > piecrust2
comparison tests/memfs.py @ 674:f987b29d6fab
tests: Add ability to run tests with a theme site.
* Remove automatic creating of `config.yml`.
* Add option to specify `theme_config` in YAML tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 06 Mar 2016 23:48:01 -0800 |
parents | e7b865f8f335 |
children |
comparison
equal
deleted
inserted
replaced
673:d6403c21bdea | 674:f987b29d6fab |
---|---|
44 self._entry.metadata['mtime'] = time.time() | 44 self._entry.metadata['mtime'] = time.time() |
45 self._stream.close() | 45 self._stream.close() |
46 | 46 |
47 | 47 |
48 class MemoryFileSystem(TestFileSystemBase): | 48 class MemoryFileSystem(TestFileSystemBase): |
49 def __init__(self, default_spec=True): | 49 def __init__(self): |
50 self._root = 'root_%d' % random.randrange(1000) | 50 self._root = 'root_%d' % random.randrange(1000) |
51 self._fs = {self._root: {}} | 51 self._fs = {self._root: {}} |
52 if default_spec: | |
53 self._initDefaultSpec() | |
54 | 52 |
55 def path(self, p): | 53 def path(self, p): |
56 p = p.replace('\\', '/') | 54 p = p.replace('\\', '/') |
57 if p in ['/', '', None]: | 55 if p in ['/', '', None]: |
58 return '/%s' % self._root | 56 return '/%s' % self._root |