Formatting: Format all python code with black.
This CL is probably not what you're looking for, it's only
automated formatting. Ignore it with
`git blame --ignore-rev <revision>` for this commit.
BUG=b:233893248
TEST=CQ
Change-Id: I66591d7a738d241aed3290138c0f68065ab10a6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3879174
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
diff --git a/scripts/sysmon/osinfo_metrics_unittest.py b/scripts/sysmon/osinfo_metrics_unittest.py
index 66913b6..4771b9f 100644
--- a/scripts/sysmon/osinfo_metrics_unittest.py
+++ b/scripts/sysmon/osinfo_metrics_unittest.py
@@ -15,43 +15,50 @@
class TestOSInfoMetrics(cros_test_lib.TestCase):
- """Tests for osinfo_metrics."""
+ """Tests for osinfo_metrics."""
- def setUp(self):
- patcher = mock.patch(
- 'chromite.third_party.infra_libs.ts_mon.common.interface.state.store',
- autospec=True)
- self.store = patcher.start()
- self.addCleanup(patcher.stop)
+ def setUp(self):
+ patcher = mock.patch(
+ "chromite.third_party.infra_libs.ts_mon.common.interface.state.store",
+ autospec=True,
+ )
+ self.store = patcher.start()
+ self.addCleanup(patcher.stop)
- def test_collect(self):
- distro = ('Ubuntu', '14.04', 'trusty')
- # This is removed in Python 3.8+.
- try:
- dist = mock.patch('platform.dist', autospec=True, return_value=distro)
- dist.start()
- except AttributeError:
- distro = ('', '', '')
- dist = None
+ def test_collect(self):
+ distro = ("Ubuntu", "14.04", "trusty")
+ # This is removed in Python 3.8+.
+ try:
+ dist = mock.patch(
+ "platform.dist", autospec=True, return_value=distro
+ )
+ dist.start()
+ except AttributeError:
+ distro = ("", "", "")
+ dist = None
- with mock.patch('platform.system', autospec=True) as system, \
- mock.patch('sys.maxsize', 2**64):
- system.return_value = 'Linux'
- if dist is not None:
- dist.return_value = distro
- osinfo_metrics.collect_os_info()
+ with mock.patch("platform.system", autospec=True) as system, mock.patch(
+ "sys.maxsize", 2**64
+ ):
+ system.return_value = "Linux"
+ if dist is not None:
+ dist.return_value = distro
+ osinfo_metrics.collect_os_info()
- if dist is not None:
- dist.stop()
+ if dist is not None:
+ dist.stop()
- setter = self.store.set
- print(setter.mock_calls)
- calls = [
- mock.call('proc/os/name', (), None, distro[0].lower(),
- enforce_ge=mock.ANY),
- mock.call('proc/os/version', (), None, distro[1], enforce_ge=mock.ANY),
- mock.call('proc/os/arch', (), None, 'x86_64', enforce_ge=mock.ANY),
- mock.call('proc/python/arch', (), None, '64', enforce_ge=mock.ANY),
- ]
- setter.assert_has_calls(calls)
- self.assertEqual(len(setter.mock_calls), len(calls))
+ setter = self.store.set
+ print(setter.mock_calls)
+ calls = [
+ mock.call(
+ "proc/os/name", (), None, distro[0].lower(), enforce_ge=mock.ANY
+ ),
+ mock.call(
+ "proc/os/version", (), None, distro[1], enforce_ge=mock.ANY
+ ),
+ mock.call("proc/os/arch", (), None, "x86_64", enforce_ge=mock.ANY),
+ mock.call("proc/python/arch", (), None, "64", enforce_ge=mock.ANY),
+ ]
+ setter.assert_has_calls(calls)
+ self.assertEqual(len(setter.mock_calls), len(calls))