# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-"""This module implements stub for publishing results in yardstick format."""
+
 import logging
 
 from yardstick.network_services.nfvi.resource import ResourceProfile
         self.bin_path = get_nsb_option('bin_path', '')
         self.resource_profiles = {}
 
-        for ctx_name, nodes in contexts_nodes.items():
-            for node in (node for node in nodes if node.get('collectd')):
+        for ctx_name, nodes in ((ctx_name, nodes) for (ctx_name, nodes)
+                                in contexts_nodes.items() if nodes):
+            for node in (node for node in nodes
+                         if node and node.get('collectd')):
                 name = ".".join([node['name'], ctx_name])
                 self.resource_profiles.update(
-                    {name: ResourceProfile.make_from_node(node, timeout)}
-                    )
+                    {name: ResourceProfile.make_from_node(node, timeout)})
 
     def start(self):
         for resource in self.resource_profiles.values():
 
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-#
 
-import unittest
+import copy
 import mock
+import unittest
 
 from yardstick.network_services.collector import subscriber
 from yardstick import ssh
 
 class CollectorTestCase(unittest.TestCase):
 
-    NODES = {'context1': [{'name': 'node1',
-                           'ip': '1.2.3.4',
-                           'collectd': {
-                               'plugins': {'abc': 12, 'def': 34},
-                               'interval': 987
-                           },
-                           }]
-             }
+    NODES = {
+        'context1': [{'name': 'node1',
+                      'ip': '1.2.3.4',
+                      'collectd': {
+                          'plugins': {'abc': 12, 'def': 34},
+                          'interval': 987}
+                      }
+        ]
+    }
 
     def setUp(self):
         vnf = MockVnfAprrox()
     def tearDown(self):
         self.ssh_patch.stop()
 
-    def test___init__(self, *_):
+    def test___init__(self, *args):
         vnf = MockVnfAprrox()
         collector = subscriber.Collector([vnf], self.NODES)
         self.assertEqual(len(collector.vnfs), 1)
         self.assertEqual(len(collector.nodes), 1)
 
-    def test_start(self, *_):
+    def test___init__no_node_information(self, *args):
+        vnf = MockVnfAprrox()
+        nodes = copy.deepcopy(self.NODES)
+        nodes['context1'].append(None)
+        collector = subscriber.Collector([vnf], nodes)
+        self.assertEqual(len(collector.vnfs), 1)
+        self.assertEqual(len(collector.nodes), 1)
+
+    def test___init__no_node_information_in_context(self, *args):
+        vnf = MockVnfAprrox()
+        nodes = copy.deepcopy(self.NODES)
+        nodes['context1'] = None
+        collector = subscriber.Collector([vnf], nodes)
+        self.assertEqual(len(collector.vnfs), 1)
+        self.assertEqual(len(collector.nodes), 1)
+
+    def test_start(self, *args):
         resource_profile = mock.MagicMock()
         self.collector.resource_profiles = {'key': resource_profile}
         self.collector.bin_path = 'path'
         for resource in self.collector.resource_profiles.values():
             resource.stop.assert_called_once()
 
-    def test_get_kpi(self, *_):
+    def test_get_kpi(self, *args):
         result = self.collector.get_kpi()
 
         self.assertEqual(2, len(result))