diff tests/conftest.py @ 411:e7b865f8f335

bake: Enable multiprocess baking. Baking is now done by running a worker per CPU, and sending jobs to them. This changes several things across the codebase: * Ability to not cache things related to pages other than the 'main' page (i.e. the page at the bottom of the execution stack). * Decouple the baking process from the bake records, so only the main process keeps track (and modifies) the bake record. * Remove the need for 'batch page getters' and loading a page directly from the page factories. There are various smaller changes too included here, including support for scope performance timers that are saved with the bake record and can be printed out to the console. Yes I got carried away. For testing, the in-memory 'mock' file-system doesn't work anymore, since we're spawning processes, so this is replaced by a 'tmpfs' file-system which is saved in temporary files on disk and deleted after tests have run.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 12 Jun 2015 17:09:19 -0700
parents a0724af26c12
children 2aa879d63133
line wrap: on
line diff
--- a/tests/conftest.py	Sat May 30 15:41:52 2015 -0700
+++ b/tests/conftest.py	Fri Jun 12 17:09:19 2015 -0700
@@ -148,36 +148,36 @@
             baker = Baker(app, out_dir)
             record = baker.bake()
 
-        if not record.success:
-            errors = []
-            for e in record.entries:
-                errors += e.getAllErrors()
-            raise BakeError(errors)
+            if not record.success:
+                errors = []
+                for e in record.entries:
+                    errors += e.getAllErrors()
+                raise BakeError(errors)
 
-        if expected_output_files:
-            actual = fs.getStructure('kitchen/_counter')
-            error = _compare_dicts(expected_output_files, actual)
-            if error:
-                raise ExpectedBakeOutputError(error)
+            if expected_output_files:
+                actual = fs.getStructure('kitchen/_counter')
+                error = _compare_dicts(expected_output_files, actual)
+                if error:
+                    raise ExpectedBakeOutputError(error)
 
-        if expected_partial_files:
-            keys = list(sorted(expected_partial_files.keys()))
-            for key in keys:
-                try:
-                    actual = fs.getFileEntry('kitchen/_counter/' +
-                                             key.lstrip('/'))
-                except Exception as e:
-                    raise ExpectedBakeOutputError([
-                        "Can't access output file %s: %s" % (key, e)])
+            if expected_partial_files:
+                keys = list(sorted(expected_partial_files.keys()))
+                for key in keys:
+                    try:
+                        actual = fs.getFileEntry('kitchen/_counter/' +
+                                                 key.lstrip('/'))
+                    except Exception as e:
+                        raise ExpectedBakeOutputError([
+                            "Can't access output file %s: %s" % (key, e)])
 
-                expected = expected_partial_files[key]
-                # HACK because for some reason PyYAML adds a new line for those
-                # and I have no idea why.
-                actual = actual.rstrip('\n')
-                expected = expected.rstrip('\n')
-                cmpres = _compare_str(expected, actual, key)
-                if cmpres:
-                    raise ExpectedBakeOutputError(cmpres)
+                    expected = expected_partial_files[key]
+                    # HACK because for some reason PyYAML adds a new line for
+                    # those and I have no idea why.
+                    actual = actual.rstrip('\n')
+                    expected = expected.rstrip('\n')
+                    cmpres = _compare_str(expected, actual, key)
+                    if cmpres:
+                        raise ExpectedBakeOutputError(cmpres)
 
     def reportinfo(self):
         return self.fspath, 0, "bake: %s" % self.name