Mercurial > piecrust2
comparison tests/test_processing_base.py @ 492:d90ccdf18156
tests: Fix processing tests on Windows.
See the comment in `pipeline.py` for more info but basically I was passing
already initialized processors to the worker pool, which means pickling the
whole app. Pretty bad. Interesting that it only broke on Windows, though.
| author | Ludovic Chabant <ludovic@chabant.com> |
|---|---|
| date | Thu, 23 Jul 2015 22:07:32 -0700 |
| parents | c4b3a7fd2f87 |
| children | c9c305645e5f |
comparison
equal
deleted
inserted
replaced
| 491:152a15046b41 | 492:d90ccdf18156 |
|---|---|
| 95 fs = (mock_fs() | 95 fs = (mock_fs() |
| 96 .withFile('kitchen/assets/blah.foo', 'A test file.')) | 96 .withFile('kitchen/assets/blah.foo', 'A test file.')) |
| 97 with mock_fs_scope(fs): | 97 with mock_fs_scope(fs): |
| 98 pp = _get_pipeline(fs) | 98 pp = _get_pipeline(fs) |
| 99 pp.enabled_processors = ['copy'] | 99 pp.enabled_processors = ['copy'] |
| 100 pp.additional_processors = [FooProcessor(('foo', 'bar'))] | 100 pp.additional_processors_factories = [ |
| 101 lambda: FooProcessor(('foo', 'bar'))] | |
| 101 pp.run() | 102 pp.run() |
| 102 expected = {'blah.bar': 'FOO: A test file.'} | 103 expected = {'blah.bar': 'FOO: A test file.'} |
| 103 assert expected == fs.getStructure('counter') | 104 assert expected == fs.getStructure('counter') |
| 104 mtime = os.path.getmtime(fs.path('/counter/blah.bar')) | 105 mtime = os.path.getmtime(fs.path('/counter/blah.bar')) |
| 105 assert abs(time.time() - mtime) <= 2 | 106 assert abs(time.time() - mtime) <= 2 |
| 143 def test_record_version_change(): | 144 def test_record_version_change(): |
| 144 fs = (mock_fs() | 145 fs = (mock_fs() |
| 145 .withFile('kitchen/assets/blah.foo', 'A test file.')) | 146 .withFile('kitchen/assets/blah.foo', 'A test file.')) |
| 146 with mock_fs_scope(fs): | 147 with mock_fs_scope(fs): |
| 147 pp = _get_pipeline(fs) | 148 pp = _get_pipeline(fs) |
| 148 noop = NoopProcessor(('foo', 'foo')) | 149 pp.enabled_processors = ['copy'] |
| 149 pp.enabled_processors = ['copy'] | 150 pp.additional_processors_factories = [ |
| 150 pp.additional_processors = [noop] | 151 lambda: NoopProcessor(('foo', 'foo'))] |
| 151 pp.run() | 152 pp.run() |
| 152 assert os.path.exists(fs.path('/counter/blah.foo')) is True | 153 assert os.path.exists(fs.path('/counter/blah.foo')) is True |
| 153 mtime = os.path.getmtime(fs.path('/counter/blah.foo')) | 154 mtime = os.path.getmtime(fs.path('/counter/blah.foo')) |
| 154 | 155 |
| 155 time.sleep(1) | 156 time.sleep(1) |
