From 74d504d54393c6d828bbcc543bd5b9b9d2ab2c19 Mon Sep 17 00:00:00 2001 From: Yushiro FURUKAWA Date: Thu, 29 Sep 2016 18:53:44 +0900 Subject: [PATCH] Use 'code-block' for pieces of code 'code-block' improves the visibility for the pieces of code. This commit splits code and result message by using 'code-block: python' and 'code-block: console'. Change-Id: Id11e0990da4dae8d47c6de7d19479cb9940890b2 --- doc/source/objects.rst | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/source/objects.rst b/doc/source/objects.rst index 5b3ac0b1d0..a3726b6008 100644 --- a/doc/source/objects.rst +++ b/doc/source/objects.rst @@ -51,16 +51,23 @@ The following example shows the unit test workflow when changing an object tox -e py27 magnum.tests.unit.objects.test_objects -This results in a unit test failure with the following output:: +This results in a unit test failure with the following output: + + .. code-block:: python testtools.matchers._impl.MismatchError: !=: reference = {'Cluster': '1.0-35edde13ad178e9419e7ea8b6d580bcd'} actual = {'Cluster': '1.0-22b40e8eed0414561ca921906b189820'} + + .. code-block:: console + : Fields or remotable methods in some objects have changed. Make sure the versions of the objects has been bumped, and update the hashes in the static fingerprints tree (object_data). For more information, read http://docs.openstack.org/developer/magnum/objects.html. This is an indication that me adding the 'foo' field to Cluster means I need to bump the version of Cluster, so I increase the version and add a comment -saying what I changed in the new version:: +saying what I changed in the new version: + + .. code-block:: python @base.MagnumObjectRegistry.register class Cluster(base.MagnumPersistentObject, base.MagnumObject, @@ -70,16 +77,19 @@ saying what I changed in the new version:: VERSION = '1.1' Now that I have updated the version, I will run the tests again and let the -test tell me the fingerprint that I now need to put in the static tree:: +test tell me the fingerprint that I now need to put in the static tree: + + .. code-block:: python testtools.matchers._impl.MismatchError: !=: reference = {'Cluster': '1.0-35edde13ad178e9419e7ea8b6d580bcd'} actual = {'Cluster': '1.1-22b40e8eed0414561ca921906b189820'} - : Fields or remotable methods in some objects have changed. Make sure the versions of the objects has been bumped, and update the hashes in the static fingerprints tree (object_data). For more information, read http://docs.openstack.org/developer/magnum/objects.html. I can now copy the new fingerprint needed (1.1-22b40e8eed0414561ca921906b189820), to the object_data map within -magnum/tests/unit/objects/test_objects.py:: +magnum/tests/unit/objects/test_objects.py: + + .. code-block:: python object_data = { 'Cluster': '1.1-22b40e8eed0414561ca921906b189820',