diff --git a/insights/parsers/od_cpu_dma_latency.py b/insights/parsers/od_cpu_dma_latency.py index 75161828cc..f9c4f241f3 100644 --- a/insights/parsers/od_cpu_dma_latency.py +++ b/insights/parsers/od_cpu_dma_latency.py @@ -31,7 +31,7 @@ class OdCpuDmaLatency(CommandParser): """ def parse_content(self, content): - if content and content[0].isdigit(): - self.force_latency = int(content[0]) + if content and content[0].strip().isdigit(): + self.force_latency = int(content[0].strip()) else: raise SkipComponent('Nothing to parse.') diff --git a/insights/tests/parsers/test_od_cpu_dma_latency.py b/insights/tests/parsers/test_od_cpu_dma_latency.py index 28aaccf913..d7dd812168 100644 --- a/insights/tests/parsers/test_od_cpu_dma_latency.py +++ b/insights/tests/parsers/test_od_cpu_dma_latency.py @@ -6,22 +6,20 @@ from insights.parsers.od_cpu_dma_latency import OdCpuDmaLatency from insights.tests import context_wrap -CONTENT_OD_CPU_DMA_LATENCY = """ - 2000000000 -""" +CONTENT_OD_CPU_DMA_LATENCY = """ 2000000000""" CONTENT_OD_CPU_DMA_LATENCY_EMPTY = "" def test_doc_examples(): - env = {'cpu_dma_latency': OdCpuDmaLatency(context_wrap(CONTENT_OD_CPU_DMA_LATENCY))} + env = {'cpu_dma_latency': OdCpuDmaLatency(context_wrap(CONTENT_OD_CPU_DMA_LATENCY, strip=False))} failed, total = doctest.testmod(od_cpu_dma_latency, globs=env) assert failed == 0 def test_OdCpuDmaLatency(): - d = OdCpuDmaLatency(context_wrap(CONTENT_OD_CPU_DMA_LATENCY)) + d = OdCpuDmaLatency(context_wrap(CONTENT_OD_CPU_DMA_LATENCY, strip=False)) assert d.force_latency == 2000000000 with pytest.raises(SkipComponent): - OdCpuDmaLatency(context_wrap(CONTENT_OD_CPU_DMA_LATENCY_EMPTY)) + OdCpuDmaLatency(context_wrap(CONTENT_OD_CPU_DMA_LATENCY_EMPTY, strip=False))