[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1001346: knack: needs update for python3.10: 'Iterable' from 'collections' is removed



Source: knack
Version: 0.9.0-1
Severity: serious
X-Debbugs-CC: debian-ci@lists.debian.org
Tags: sid bookworm
User: debian-ci@lists.debian.org
Usertags: needs-update
Control: affects -1 src:python3-defaults

Dear maintainer(s),

With a recent upload of python3-defaults the autopkgtest of knack fails in testing when that autopkgtest is run with the binary packages of python3-defaults from unstable. It passes when run with only packages from testing. In tabular form:

                       pass            fail
python3-defaults       from testing    3.9.8-1
knack                  from testing    0.9.0-1
all others             from testing    from testing

I copied some of the output at the bottom of this report. https://docs.python.org/3.9/library/collections.html says:
"""
Deprecated since version 3.3, will be removed in version 3.10: Moved Collections Abstract Base Classes to the collections.abc module. For backwards compatibility, they continue to be visible in this module through Python 3.9.
"""
Time to move on.

Currently this regression is blocking the migration of python3-defaults to testing [1].

More information about this bug and the reason for filing it can be found on
https://wiki.debian.org/ContinuousIntegration/RegressionEmailInformation

Paul

[1] https://qa.debian.org/excuses.php?package=python3-defaults

https://ci.debian.net/data/autopkgtest/testing/amd64/k/knack/17376876/log.gz

=================================== FAILURES =================================== __________________________ TestOutput.test_out_table ___________________________

obj = <knack.util.CommandResultItem object at 0x7fe1d7590910>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
          return to.dump(result_list)

/usr/lib/python3/dist-packages/knack/output.py:76: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <knack.output._TableOutput object at 0x7fe1d75934f0>
data = [OrderedDict([('active', True), ('val', '0b1f6472'), ('lun', 0)])]

    def dump(self, data):
      from tabulate import tabulate

/usr/lib/python3/dist-packages/knack/output.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    # -*- coding: utf-8 -*-
        """Pretty-print tabular data."""
        from __future__ import print_function
    from __future__ import unicode_literals
    from collections import namedtuple
    from platform import python_version_tuple
    import re
    import math
            if python_version_tuple() >= ("3", "3", "0"):
        from collections.abc import Iterable
    else:
      from collections import Iterable
E ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

/usr/lib/python3/dist-packages/tabulate.py:16: ImportError

The above exception was the direct cause of the following exception:

self = <tests.test_output.TestOutput testMethod=test_out_table>

    def test_out_table(self):
        output_producer = OutputProducer(cli_ctx=self.mock_ctx)
        obj = OrderedDict()
        obj['active'] = True
        obj['val'] = '0b1f6472'
        obj['lun'] = 0
      output_producer.out(CommandResultItem(obj), formatter=format_table, out_file=self.io)

tests/test_output.py:158: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/knack/output.py:146: in out
    output = formatter(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <knack.util.CommandResultItem object at 0x7fe1d7590910>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
            return to.dump(result_list)
        except Exception as ex:
            logger.debug(traceback.format_exc())
          raise CLIError("Table output unavailable. "
"Use the --query option to specify an appropriate query. "
                           "Use --debug for more info.") from ex
E knack.util.CLIError: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

/usr/lib/python3/dist-packages/knack/output.py:79: CLIError
____________________ TestOutput.test_out_table_complex_obj _____________________

obj = <knack.util.CommandResultItem object at 0x7fe1d74008b0>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
          return to.dump(result_list)

/usr/lib/python3/dist-packages/knack/output.py:76: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <knack.output._TableOutput object at 0x7fe1d7403940>
data = [OrderedDict([('name', 'qwerty'), ('val', '0b1f6472qwerty'), ('sub', {'1'})])]

    def dump(self, data):
      from tabulate import tabulate

/usr/lib/python3/dist-packages/knack/output.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    # -*- coding: utf-8 -*-
        """Pretty-print tabular data."""
        from __future__ import print_function
    from __future__ import unicode_literals
    from collections import namedtuple
    from platform import python_version_tuple
    import re
    import math
            if python_version_tuple() >= ("3", "3", "0"):
        from collections.abc import Iterable
    else:
      from collections import Iterable
E ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

/usr/lib/python3/dist-packages/tabulate.py:16: ImportError

The above exception was the direct cause of the following exception:

self = <tests.test_output.TestOutput testMethod=test_out_table_complex_obj>

    def test_out_table_complex_obj(self):
        output_producer = OutputProducer(cli_ctx=self.mock_ctx)
        obj = OrderedDict()
        obj['name'] = 'qwerty'
        obj['val'] = '0b1f6472qwerty'
        obj['sub'] = {'1'}
        result_item = CommandResultItem(obj)
      output_producer.out(result_item, formatter=format_table, out_file=self.io)

tests/test_output.py:183: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/knack/output.py:146: in out
    output = formatter(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <knack.util.CommandResultItem object at 0x7fe1d74008b0>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
            return to.dump(result_list)
        except Exception as ex:
            logger.debug(traceback.format_exc())
          raise CLIError("Table output unavailable. "
"Use the --query option to specify an appropriate query. "
                           "Use --debug for more info.") from ex
E knack.util.CLIError: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

/usr/lib/python3/dist-packages/knack/output.py:79: CLIError
___________________ TestOutput.test_out_table_list_of_lists ____________________

obj = <knack.util.CommandResultItem object at 0x7fe1d716d9f0>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
          return to.dump(result_list)

/usr/lib/python3/dist-packages/knack/output.py:76: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <knack.output._TableOutput object at 0x7fe1d716d9c0>
data = [['a', 'b'], ['c', 'd']]

    def dump(self, data):
      from tabulate import tabulate

/usr/lib/python3/dist-packages/knack/output.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    # -*- coding: utf-8 -*-
        """Pretty-print tabular data."""
        from __future__ import print_function
    from __future__ import unicode_literals
    from collections import namedtuple
    from platform import python_version_tuple
    import re
    import math
            if python_version_tuple() >= ("3", "3", "0"):
        from collections.abc import Iterable
    else:
      from collections import Iterable
E ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

/usr/lib/python3/dist-packages/tabulate.py:16: ImportError

The above exception was the direct cause of the following exception:

self = <tests.test_output.TestOutput testMethod=test_out_table_list_of_lists>

    def test_out_table_list_of_lists(self):
        output_producer = OutputProducer(cli_ctx=self.mock_ctx)
        obj = [['a', 'b'], ['c', 'd']]
      output_producer.out(CommandResultItem(obj), formatter=format_table, out_file=self.io)

tests/test_output.py:168: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/knack/output.py:146: in out
    output = formatter(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <knack.util.CommandResultItem object at 0x7fe1d716d9f0>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
            return to.dump(result_list)
        except Exception as ex:
            logger.debug(traceback.format_exc())
          raise CLIError("Table output unavailable. "
"Use the --query option to specify an appropriate query. "
                           "Use --debug for more info.") from ex
E knack.util.CLIError: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

/usr/lib/python3/dist-packages/knack/output.py:79: CLIError
___________ TestOutput.test_out_table_no_query_no_transformer_order ____________

obj = <knack.util.CommandResultItem object at 0x7fe1d7174fa0>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
          return to.dump(result_list)

/usr/lib/python3/dist-packages/knack/output.py:76: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <knack.output._TableOutput object at 0x7fe1d71750f0>
data = [{'active': True, 'name': 'qwerty', 'sub': '0b1f6472', 'val': '0b1f6472qwerty'}]

    def dump(self, data):
      from tabulate import tabulate

/usr/lib/python3/dist-packages/knack/output.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    # -*- coding: utf-8 -*-
        """Pretty-print tabular data."""
        from __future__ import print_function
    from __future__ import unicode_literals
    from collections import namedtuple
    from platform import python_version_tuple
    import re
    import math
            if python_version_tuple() >= ("3", "3", "0"):
        from collections.abc import Iterable
    else:
      from collections import Iterable
E ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

/usr/lib/python3/dist-packages/tabulate.py:16: ImportError

The above exception was the direct cause of the following exception:

self = <tests.test_output.TestOutput testMethod=test_out_table_no_query_no_transformer_order>

    def test_out_table_no_query_no_transformer_order(self):
        output_producer = OutputProducer(cli_ctx=self.mock_ctx)
obj = {'name': 'qwerty', 'val': '0b1f6472qwerty', 'active': True, 'sub': '0b1f6472'} result_item = CommandResultItem(obj, table_transformer=None, is_query_active=False)
      output_producer.out(result_item, formatter=format_table, out_file=self.io)

tests/test_output.py:194: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/knack/output.py:146: in out
    output = formatter(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <knack.util.CommandResultItem object at 0x7fe1d7174fa0>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
            return to.dump(result_list)
        except Exception as ex:
            logger.debug(traceback.format_exc())
          raise CLIError("Table output unavailable. "
"Use the --query option to specify an appropriate query. "
                           "Use --debug for more info.") from ex
E knack.util.CLIError: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

/usr/lib/python3/dist-packages/knack/output.py:79: CLIError
______ TestOutput.test_out_table_no_query_yes_jmespath_table_transformer _______

obj = <knack.util.CommandResultItem object at 0x7fe1d7179780>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
          return to.dump(result_list)

/usr/lib/python3/dist-packages/knack/output.py:76: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <knack.output._TableOutput object at 0x7fe1d71795d0>
data = [OrderedDict([('Name', 'qwerty'), ('Val', '0b1f6472qwerty'), ('Active', True)])]

    def dump(self, data):
      from tabulate import tabulate

/usr/lib/python3/dist-packages/knack/output.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    # -*- coding: utf-8 -*-
        """Pretty-print tabular data."""
        from __future__ import print_function
    from __future__ import unicode_literals
    from collections import namedtuple
    from platform import python_version_tuple
    import re
    import math
            if python_version_tuple() >= ("3", "3", "0"):
        from collections.abc import Iterable
    else:
      from collections import Iterable
E ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

/usr/lib/python3/dist-packages/tabulate.py:16: ImportError

The above exception was the direct cause of the following exception:

self = <tests.test_output.TestOutput testMethod=test_out_table_no_query_yes_jmespath_table_transformer>

    def test_out_table_no_query_yes_jmespath_table_transformer(self):
        output_producer = OutputProducer(cli_ctx=self.mock_ctx)
obj = {'name': 'qwerty', 'val': '0b1f6472qwerty', 'active': True, 'sub': '0b1f6472'}
            result_item = CommandResultItem(obj,
table_transformer='{Name:name, Val:val, Active:active}',
                                        is_query_active=False)
      output_producer.out(result_item, formatter=format_table, out_file=self.io)

tests/test_output.py:226: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/knack/output.py:146: in out
    output = formatter(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <knack.util.CommandResultItem object at 0x7fe1d7179780>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
            return to.dump(result_list)
        except Exception as ex:
            logger.debug(traceback.format_exc())
          raise CLIError("Table output unavailable. "
"Use the --query option to specify an appropriate query. "
                           "Use --debug for more info.") from ex
E knack.util.CLIError: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

/usr/lib/python3/dist-packages/knack/output.py:79: CLIError
___________ TestOutput.test_out_table_no_query_yes_transformer_order ___________

obj = <knack.util.CommandResultItem object at 0x7fe1d70d4f10>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
          return to.dump(result_list)

/usr/lib/python3/dist-packages/knack/output.py:76: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <knack.output._TableOutput object at 0x7fe1d70d47c0>
data = [OrderedDict([('Name', 'qwerty'), ('Val', '0b1f6472qwerty'), ('Active', True), ('Sub', '0b1f6472')])]

    def dump(self, data):
      from tabulate import tabulate

/usr/lib/python3/dist-packages/knack/output.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    # -*- coding: utf-8 -*-
        """Pretty-print tabular data."""
        from __future__ import print_function
    from __future__ import unicode_literals
    from collections import namedtuple
    from platform import python_version_tuple
    import re
    import math
            if python_version_tuple() >= ("3", "3", "0"):
        from collections.abc import Iterable
    else:
      from collections import Iterable
E ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

/usr/lib/python3/dist-packages/tabulate.py:16: ImportError

The above exception was the direct cause of the following exception:

self = <tests.test_output.TestOutput testMethod=test_out_table_no_query_yes_transformer_order>

    def test_out_table_no_query_yes_transformer_order(self):
        output_producer = OutputProducer(cli_ctx=self.mock_ctx)
obj = {'name': 'qwerty', 'val': '0b1f6472qwerty', 'active': True, 'sub': '0b1f6472'}
            def transformer(r):
            return OrderedDict([('Name', r['name']), ('Val', r['val']),
('Active', r['active']), ('Sub', r['sub'])]) result_item = CommandResultItem(obj, table_transformer=transformer, is_query_active=False)
      output_producer.out(result_item, formatter=format_table, out_file=self.io)

tests/test_output.py:211: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/knack/output.py:146: in out
    output = formatter(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <knack.util.CommandResultItem object at 0x7fe1d70d4f10>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
            return to.dump(result_list)
        except Exception as ex:
            logger.debug(traceback.format_exc())
          raise CLIError("Table output unavailable. "
"Use the --query option to specify an appropriate query. "
                           "Use --debug for more info.") from ex
E knack.util.CLIError: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

/usr/lib/python3/dist-packages/knack/output.py:79: CLIError
____________________ TestOutput.test_out_table_with_number _____________________

obj = <knack.util.CommandResultItem object at 0x7fe1d713b070>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
          return to.dump(result_list)

/usr/lib/python3/dist-packages/knack/output.py:76: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <knack.output._TableOutput object at 0x7fe1d71387c0>
data = [OrderedDict([('Sku', '6.10')])]

    def dump(self, data):
      from tabulate import tabulate

/usr/lib/python3/dist-packages/knack/output.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    # -*- coding: utf-8 -*-
        """Pretty-print tabular data."""
        from __future__ import print_function
    from __future__ import unicode_literals
    from collections import namedtuple
    from platform import python_version_tuple
    import re
    import math
            if python_version_tuple() >= ("3", "3", "0"):
        from collections.abc import Iterable
    else:
      from collections import Iterable
E ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

/usr/lib/python3/dist-packages/tabulate.py:16: ImportError

The above exception was the direct cause of the following exception:

self = <tests.test_output.TestOutput testMethod=test_out_table_with_number>

    def test_out_table_with_number(self):
        output_producer = OutputProducer(cli_ctx=self.mock_ctx)
        obj = OrderedDict()
        obj['Sku'] = '6.10'
      output_producer.out(CommandResultItem(obj), formatter=format_table, out_file=self.io)

tests/test_output.py:238: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/knack/output.py:146: in out
    output = formatter(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <knack.util.CommandResultItem object at 0x7fe1d713b070>

    def format_table(obj):
        result = obj.result
        try:
            if obj.table_transformer and not obj.is_query_active:
                if isinstance(obj.table_transformer, str):
                    from jmespath import compile as compile_jmes, Options
result = compile_jmes(obj.table_transformer).search(result, Options(OrderedDict))
                else:
                    result = obj.table_transformer(result)
            result_list = result if isinstance(result, list) else [result]
should_sort_keys = not obj.is_query_active and not obj.table_transformer
            to = _TableOutput(should_sort_keys)
            return to.dump(result_list)
        except Exception as ex:
            logger.debug(traceback.format_exc())
          raise CLIError("Table output unavailable. "
"Use the --query option to specify an appropriate query. "
                           "Use --debug for more info.") from ex
E knack.util.CLIError: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

/usr/lib/python3/dist-packages/knack/output.py:79: CLIError
=============================== warnings summary ===============================
tests/test_deprecation.py::TestCommandDeprecation::test_deprecate_command_expired_execute
/usr/lib/python3/dist-packages/knack/deprecation.py:101: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
    from distutils.version import LooseVersion

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================ FAILED tests/test_output.py::TestOutput::test_out_table - knack.util.CLIError... FAILED tests/test_output.py::TestOutput::test_out_table_complex_obj - knack.u... FAILED tests/test_output.py::TestOutput::test_out_table_list_of_lists - knack... FAILED tests/test_output.py::TestOutput::test_out_table_no_query_no_transformer_order FAILED tests/test_output.py::TestOutput::test_out_table_no_query_yes_jmespath_table_transformer FAILED tests/test_output.py::TestOutput::test_out_table_no_query_yes_transformer_order FAILED tests/test_output.py::TestOutput::test_out_table_with_number - knack.u... =================== 7 failed, 228 passed, 1 warning in 1.72s ===================
autopkgtest [21:41:37]: test python3-tests

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Reply to: