← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1988097] [NEW] some unit tests fail with prettytable 3.4.0

 

Public bug reported:

Reported in the nova channel [1]:

[10:43:18]  <frickler> latest prettytable is breaking a nova unit test,
if anyone wants to have a look
https://zuul.opendev.org/t/openstack/build/2e4535d6aa2d4fd987ddfd0d0bc296d1

Looks like a minor issue, the new version of prettytable 3.4.0 is
center-aligning table field names whereas older versions left-align
field names. Example failure:

    Traceback (most recent call last):
      File "/usr/lib/python3.8/unittest/mock.py", line 1325, in patched
        return func(*newargs, **newkeywargs)
      File "/home/zuul/src/opendev.org/openstack/nova/nova/tests/unit/cmd/test_manage.py", line 396, in test_archive_deleted_rows_until_stopped
        self.assertEqual(expected, self.output.getvalue())
      File "/home/zuul/src/opendev.org/openstack/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 393, in assertEqual
        self.assertThat(observed, matcher, message)
      File "/home/zuul/src/opendev.org/openstack/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 480, in assertThat
        raise mismatch_error
    testtools.matchers._impl.MismatchError: !=: 
    reference = '''\
    Archiving.....stopped
    +-----------------+-------------------------+
    | Table           | Number of Rows Archived |
    +-----------------+-------------------------+
    | instance_extra  | 5                       |   
    | instance_faults | 1                       |   
    | instances       | 15                      |   
    +-----------------+-------------------------+
    Rows were archived, running purge...
    ''' 
    actual    = '''\
    Archiving.....stopped
    +-----------------+-------------------------+
    |      Table      | Number of Rows Archived |
    +-----------------+-------------------------+
    | instance_extra  | 5                       |   
    | instance_faults | 1                       |   
    | instances       | 15                      |   
    +-----------------+-------------------------+
    Rows were archived, running purge...
    ''' 

The asserts need to be adjusted to tolerate the new alignment.

[1] https://meetings.opendev.org/irclogs/%23openstack-nova/%23openstack-
nova.2022-08-27.log.html#t2022-08-27T17:43:18

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: low-hanging-fruit testing

** Description changed:

  Reported in the nova channel [1]:
  
  [10:43:18]  <frickler> latest prettytable is breaking a nova unit test,
  if anyone wants to have a look
  https://zuul.opendev.org/t/openstack/build/2e4535d6aa2d4fd987ddfd0d0bc296d1
  
  Looks like a minor issue, the new version of prettytable 3.4.0 is
  center-aligning table field names whereas older versions left-align
  field names. Example failure:
  
- Traceback (most recent call last):
-   File "/usr/lib/python3.8/unittest/mock.py", line 1325, in patched
-     return func(*newargs, **newkeywargs)
-   File "/home/zuul/src/opendev.org/openstack/nova/nova/tests/unit/cmd/test_manage.py", line 396, in test_archive_deleted_rows_until_stopped
-     self.assertEqual(expected, self.output.getvalue())
-   File "/home/zuul/src/opendev.org/openstack/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 393, in assertEqual
-     self.assertThat(observed, matcher, message)
-   File "/home/zuul/src/opendev.org/openstack/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 480, in assertThat
-     raise mismatch_error
- testtools.matchers._impl.MismatchError: !=:
- reference = '''\
- Archiving.....stopped
- +-----------------+-------------------------+
- | Table           | Number of Rows Archived |
- +-----------------+-------------------------+
- | instance_extra  | 5                       |
- | instance_faults | 1                       |
- | instances       | 15                      |
- +-----------------+-------------------------+
- Rows were archived, running purge...
- '''
- actual    = '''\
- Archiving.....stopped
- +-----------------+-------------------------+
- |      Table      | Number of Rows Archived |
- +-----------------+-------------------------+
- | instance_extra  | 5                       |
- | instance_faults | 1                       |
- | instances       | 15                      |
- +-----------------+-------------------------+
- Rows were archived, running purge...
- '''
+     Traceback (most recent call last):
+       File "/usr/lib/python3.8/unittest/mock.py", line 1325, in patched
+         return func(*newargs, **newkeywargs)
+       File "/home/zuul/src/opendev.org/openstack/nova/nova/tests/unit/cmd/test_manage.py", line 396, in test_archive_deleted_rows_until_stopped
+         self.assertEqual(expected, self.output.getvalue())
+       File "/home/zuul/src/opendev.org/openstack/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 393, in assertEqual
+         self.assertThat(observed, matcher, message)
+       File "/home/zuul/src/opendev.org/openstack/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 480, in assertThat
+         raise mismatch_error
+     testtools.matchers._impl.MismatchError: !=: 
+     reference = '''\
+     Archiving.....stopped
+     +-----------------+-------------------------+
+     | Table           | Number of Rows Archived |
+     +-----------------+-------------------------+
+     | instance_extra  | 5                       |   
+     | instance_faults | 1                       |   
+     | instances       | 15                      |   
+     +-----------------+-------------------------+
+     Rows were archived, running purge...
+     ''' 
+     actual    = '''\
+     Archiving.....stopped
+     +-----------------+-------------------------+
+     |      Table      | Number of Rows Archived |
+     +-----------------+-------------------------+
+     | instance_extra  | 5                       |   
+     | instance_faults | 1                       |   
+     | instances       | 15                      |   
+     +-----------------+-------------------------+
+     Rows were archived, running purge...
+     ''' 
  
  The asserts need to be adjusted to tolerate the new alignment.
  
  [1] https://meetings.opendev.org/irclogs/%23openstack-nova/%23openstack-
  nova.2022-08-27.log.html#t2022-08-27T17:43:18

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1988097

Title:
  some unit tests fail with prettytable 3.4.0

Status in OpenStack Compute (nova):
  New

Bug description:
  Reported in the nova channel [1]:

  [10:43:18]  <frickler> latest prettytable is breaking a nova unit
  test, if anyone wants to have a look
  https://zuul.opendev.org/t/openstack/build/2e4535d6aa2d4fd987ddfd0d0bc296d1

  Looks like a minor issue, the new version of prettytable 3.4.0 is
  center-aligning table field names whereas older versions left-align
  field names. Example failure:

      Traceback (most recent call last):
        File "/usr/lib/python3.8/unittest/mock.py", line 1325, in patched
          return func(*newargs, **newkeywargs)
        File "/home/zuul/src/opendev.org/openstack/nova/nova/tests/unit/cmd/test_manage.py", line 396, in test_archive_deleted_rows_until_stopped
          self.assertEqual(expected, self.output.getvalue())
        File "/home/zuul/src/opendev.org/openstack/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 393, in assertEqual
          self.assertThat(observed, matcher, message)
        File "/home/zuul/src/opendev.org/openstack/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 480, in assertThat
          raise mismatch_error
      testtools.matchers._impl.MismatchError: !=: 
      reference = '''\
      Archiving.....stopped
      +-----------------+-------------------------+
      | Table           | Number of Rows Archived |
      +-----------------+-------------------------+
      | instance_extra  | 5                       |   
      | instance_faults | 1                       |   
      | instances       | 15                      |   
      +-----------------+-------------------------+
      Rows were archived, running purge...
      ''' 
      actual    = '''\
      Archiving.....stopped
      +-----------------+-------------------------+
      |      Table      | Number of Rows Archived |
      +-----------------+-------------------------+
      | instance_extra  | 5                       |   
      | instance_faults | 1                       |   
      | instances       | 15                      |   
      +-----------------+-------------------------+
      Rows were archived, running purge...
      ''' 

  The asserts need to be adjusted to tolerate the new alignment.

  [1] https://meetings.opendev.org/irclogs/%23openstack-
  nova/%23openstack-nova.2022-08-27.log.html#t2022-08-27T17:43:18

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1988097/+subscriptions