question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Packaging for openSUSE: TypeError and AssertionError

See original GitHub issue

Hello,

I am trying to package this into openSUSE Tumbleweed. Could it be about protobuf issue?

Thanks. The installed packages are as follows.

freezegun 0.3.15
google-api-core 1.17.0
matplotlib 3.2.2
networkx =2.4
numpy  1.18.4
pandas 1.0.5
ply 3.11
protobuf  3.12.3
pytest 5.4.3
pytest-benchmark 3.2.3
pytest-asyncio 0.14.0
requests 2.23.0
scipy 1.4.1
setuptools 44.0.0
sortedcontainers 2.2.2
sympy 1.6
typing_extensions 3.7.4
[  226s] =================================== FAILURES ===================================
[  226s] ___________________ test_serialize_conversion[value1-proto1] ___________________
[  226s] 
[  226s] value = array([ True, False])
[  226s] proto = {'arg_value': {'bool_values': {'values': [True, False]}}}
[  226s] 
[  226s]     @pytest.mark.parametrize('value,proto', [
[  226s]         ((True, False), {
[  226s]             'arg_value': {
[  226s]                 'bool_values': {
[  226s]                     'values': [True, False]
[  226s]                 }
[  226s]             }
[  226s]         }),
[  226s]         (np.array([True, False], dtype=np.bool), {
[  226s]             'arg_value': {
[  226s]                 'bool_values': {
[  226s]                     'values': [True, False]
[  226s]                 }
[  226s]             }
[  226s]         }),
[  226s]     ])
[  226s]     def test_serialize_conversion(value: ARG_LIKE, proto: v2.program_pb2.Arg):
[  226s]         msg = v2.program_pb2.Arg()
[  226s]         json_format.ParseDict(proto, msg)
[  226s] >       packed = json_format.MessageToDict(_arg_to_proto(value,
[  226s]                                                          arg_function_language=''),
[  226s]                                            including_default_value_fields=True,
[  226s]                                            preserving_proto_field_name=True,
[  226s]                                            use_integers_for_enums=True)
[  226s] 
[  226s] cirq/google/arg_func_langs_test.py:142: 
[  226s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  226s] cirq/google/arg_func_langs.py:131: in _arg_to_proto
[  226s]     msg.arg_value.bool_values.values.extend(value)
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/containers.py:282: in extend
[  226s]     new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/containers.py:282: in <listcomp>
[  226s]     new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
[  226s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  226s] 
[  226s] self = <google.protobuf.internal.type_checkers.TypeCheckerWithDefault object at 0x7f1942956520>
[  226s] proposed_value = True
[  226s] 
[  226s]     def CheckValue(self, proposed_value):
[  226s]       """Type check the provided value and return it.
[  226s]     
[  226s]       The returned value might have been normalized to another type.
[  226s]       """
[  226s]       if not isinstance(proposed_value, self._acceptable_types):
[  226s]         message = ('%.1024r has type %s, but expected one of: %s' %
[  226s]                    (proposed_value, type(proposed_value), self._acceptable_types))
[  226s] >       raise TypeError(message)
[  226s] E       TypeError: True has type <class 'numpy.bool_'>, but expected one of: (<class 'bool'>, <class 'numbers.Integral'>)
[  226s] 
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/type_checkers.py:142: TypeError
[  226s] ______________ test_to_proto_attribute[val_type5-val5-arg_value5] ______________
[  226s] 
[  226s] val_type = typing.List[bool], val = array([ True, False])
[  226s] arg_value = {'arg_value': {'bool_values': {'values': [True, False]}}}
[  226s] 
[  226s]     @pytest.mark.parametrize(('val_type', 'val', 'arg_value'), TEST_CASES)
[  226s]     def test_to_proto_attribute(val_type, val, arg_value):
[  226s]         serializer = cg.GateOpSerializer(gate_type=GateWithAttribute,
[  226s]                                          serialized_gate_id='my_gate',
[  226s]                                          args=[
[  226s]                                              cg.SerializingArg(
[  226s]                                                  serialized_name='my_val',
[  226s]                                                  serialized_type=val_type,
[  226s]                                                  op_getter='val')
[  226s]                                          ])
[  226s]         q = cirq.GridQubit(1, 2)
[  226s] >       result = serializer.to_proto(GateWithAttribute(val)(q),
[  226s]                                      arg_function_language='linear')
[  226s] 
[  226s] cirq/google/op_serializer_test.py:146: 
[  226s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  226s] cirq/google/op_serializer.py:128: in to_proto
[  226s]     _arg_to_proto(value,
[  226s] cirq/google/arg_func_langs.py:131: in _arg_to_proto
[  226s]     msg.arg_value.bool_values.values.extend(value)
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/containers.py:282: in extend
[  226s]     new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/containers.py:282: in <listcomp>
[  226s]     new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
[  226s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  226s] 
[  226s] self = <google.protobuf.internal.type_checkers.TypeCheckerWithDefault object at 0x7f1942956520>
[  226s] proposed_value = True
[  226s] 
[  226s]     def CheckValue(self, proposed_value):
[  226s]       """Type check the provided value and return it.
[  226s]     
[  226s]       The returned value might have been normalized to another type.
[  226s]       """
[  226s]       if not isinstance(proposed_value, self._acceptable_types):
[  226s]         message = ('%.1024r has type %s, but expected one of: %s' %
[  226s]                    (proposed_value, type(proposed_value), self._acceptable_types))
[  226s] >       raise TypeError(message)
[  226s] E       TypeError: True has type <class 'numpy.bool_'>, but expected one of: (<class 'bool'>, <class 'numbers.Integral'>)
[  226s] 
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/type_checkers.py:142: TypeError
[  226s] ______________ test_to_proto_property[val_type5-val5-arg_value5] _______________
[  226s] 
[  226s] val_type = typing.List[bool], val = array([ True, False])
[  226s] arg_value = {'arg_value': {'bool_values': {'values': [True, False]}}}
[  226s] 
[  226s]     @pytest.mark.parametrize(('val_type', 'val', 'arg_value'), TEST_CASES)
[  226s]     def test_to_proto_property(val_type, val, arg_value):
[  226s]         serializer = cg.GateOpSerializer(gate_type=GateWithProperty,
[  226s]                                          serialized_gate_id='my_gate',
[  226s]                                          args=[
[  226s]                                              cg.SerializingArg(
[  226s]                                                  serialized_name='my_val',
[  226s]                                                  serialized_type=val_type,
[  226s]                                                  op_getter='val')
[  226s]                                          ])
[  226s]         q = cirq.GridQubit(1, 2)
[  226s] >       result = serializer.to_proto(GateWithProperty(val)(q),
[  226s]                                      arg_function_language='linear')
[  226s] 
[  226s] cirq/google/op_serializer_test.py:173: 
[  226s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  226s] cirq/google/op_serializer.py:128: in to_proto
[  226s]     _arg_to_proto(value,
[  226s] cirq/google/arg_func_langs.py:131: in _arg_to_proto
[  226s]     msg.arg_value.bool_values.values.extend(value)
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/containers.py:282: in extend
[  226s]     new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/containers.py:282: in <listcomp>
[  226s]     new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
[  226s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  226s] 
[  226s] self = <google.protobuf.internal.type_checkers.TypeCheckerWithDefault object at 0x7f1942956520>
[  226s] proposed_value = True
[  226s] 
[  226s]     def CheckValue(self, proposed_value):
[  226s]       """Type check the provided value and return it.
[  226s]     
[  226s]       The returned value might have been normalized to another type.
[  226s]       """
[  226s]       if not isinstance(proposed_value, self._acceptable_types):
[  226s]         message = ('%.1024r has type %s, but expected one of: %s' %
[  226s]                    (proposed_value, type(proposed_value), self._acceptable_types))
[  226s] >       raise TypeError(message)
[  226s] E       TypeError: True has type <class 'numpy.bool_'>, but expected one of: (<class 'bool'>, <class 'numbers.Integral'>)
[  226s] 
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/type_checkers.py:142: TypeError
[  226s] ______________ test_to_proto_callable[val_type5-val5-arg_value5] _______________
[  226s] 
[  226s] val_type = typing.List[bool], val = array([ True, False])
[  226s] arg_value = {'arg_value': {'bool_values': {'values': [True, False]}}}
[  226s] 
[  226s]     @pytest.mark.parametrize(('val_type', 'val', 'arg_value'), TEST_CASES)
[  226s]     def test_to_proto_callable(val_type, val, arg_value):
[  226s]         serializer = cg.GateOpSerializer(gate_type=GateWithMethod,
[  226s]                                          serialized_gate_id='my_gate',
[  226s]                                          args=[
[  226s]                                              cg.SerializingArg(
[  226s]                                                  serialized_name='my_val',
[  226s]                                                  serialized_type=val_type,
[  226s]                                                  op_getter=get_val)
[  226s]                                          ])
[  226s]         q = cirq.GridQubit(1, 2)
[  226s] >       result = serializer.to_proto(GateWithMethod(val)(q),
[  226s]                                      arg_function_language='linear')
[  226s] 
[  226s] cirq/google/op_serializer_test.py:200: 
[  226s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  226s] cirq/google/op_serializer.py:128: in to_proto
[  226s]     _arg_to_proto(value,
[  226s] cirq/google/arg_func_langs.py:131: in _arg_to_proto
[  226s]     msg.arg_value.bool_values.values.extend(value)
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/containers.py:282: in extend
[  226s]     new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/containers.py:282: in <listcomp>
[  226s]     new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
[  226s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  226s] 
[  226s] self = <google.protobuf.internal.type_checkers.TypeCheckerWithDefault object at 0x7f1942956520>
[  226s] proposed_value = True
[  226s] 
[  226s]     def CheckValue(self, proposed_value):
[  226s]       """Type check the provided value and return it.
[  226s]     
[  226s]       The returned value might have been normalized to another type.
[  226s]       """
[  226s]       if not isinstance(proposed_value, self._acceptable_types):
[  226s]         message = ('%.1024r has type %s, but expected one of: %s' %
[  226s]                    (proposed_value, type(proposed_value), self._acceptable_types))
[  226s] >       raise TypeError(message)
[  226s] E       TypeError: True has type <class 'numpy.bool_'>, but expected one of: (<class 'bool'>, <class 'numbers.Integral'>)
[  226s] 
[  226s] /usr/lib/python3.8/site-packages/google/protobuf/internal/type_checkers.py:142: TypeError
[  226s] ___________________ test_pytest_changed_files_file_selection ___________________
[  226s] 
[  226s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f19548e4850>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  226s] 
[  226s]     @only_on_posix
[  226s]     def test_pytest_changed_files_file_selection(tmpdir_factory):
[  226s]     
[  226s]         result = run(script_file='check/pytest-changed-files',
[  226s]                      tmpdir_factory=tmpdir_factory,
[  226s]                      arg='HEAD~1',
[  226s]                      setup='touch file.py\n'
[  226s]                      'git add -A\n'
[  226s]                      'git commit -m test --quiet --no-gpg-sign\n')
[  226s] >       assert result.exit_code == 0
[  226s] E       assert 1 == 0
[  226s] E         +1
[  226s] E         -0
[  226s] 
[  226s] dev_tools/bash_scripts_test.py:88: AssertionError
[  226s] __________________ test_pytest_changed_files_branch_selection __________________
[  226s] 
[  226s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f19548e4850>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  226s] 
[  226s]     @only_on_posix
[  226s]     def test_pytest_changed_files_branch_selection(tmpdir_factory):
[  226s]     
[  226s]         result = run(script_file='check/pytest-changed-files',
[  226s]                      tmpdir_factory=tmpdir_factory,
[  226s]                      arg='HEAD')
[  226s] >       assert result.exit_code == 0
[  226s] E       assert 1 == 0
[  226s] E         +1
[  226s] E         -0
[  226s] 
[  226s] dev_tools/bash_scripts_test.py:165: AssertionError
[  226s] ____________ test_pytest_and_incremental_coverage_branch_selection _____________
[  226s] 
[  226s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f19548e4850>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  226s] 
[  226s]     @only_on_posix
[  226s]     def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory):
[  226s]         result = run(script_file='check/pytest-and-incremental-coverage',
[  226s]                      tmpdir_factory=tmpdir_factory,
[  226s]                      arg='HEAD',
[  226s]                      additional_intercepts=['check/pytest'])
[  226s] >       assert result.exit_code == 0
[  226s] E       assert 1 == 0
[  226s] E         +1
[  226s] E         -0
[  226s] 
[  226s] dev_tools/bash_scripts_test.py:280: AssertionError
[  226s] ___________________ test_incremental_format_branch_selection ___________________
[  226s] 
[  226s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f19548e4850>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  226s] 
[  226s]     @only_on_posix
[  226s]     def test_incremental_format_branch_selection(tmpdir_factory):
[  226s]         result = run(script_file='check/format-incremental',
[  226s]                      tmpdir_factory=tmpdir_factory,
[  226s]                      arg='HEAD')
[  226s] >       assert result.exit_code == 0
[  226s] E       assert 1 == 0
[  226s] E         +1
[  226s] E         -0
[  226s] 
[  226s] dev_tools/bash_scripts_test.py:415: AssertionError
[  226s] =============================== warnings summary ===============================

Full log here: https://build.opensuse.org/build/home:andythe_great/openSUSE_Tumbleweed/x86_64/python-cirq/_log

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danchevcommented, Sep 27, 2020

As described in the Development documentation there are two ways to run tests - slow and fast. Fast way uses git to determine which local files were modified, in order to run pytest against only those files that were modified/deffer from the BASE_REVISION. In order for fast tests to run, a local repository (.git directory) needs to be present. Git repository (.git directory) is not included in the official releases, and since local git repository is missing but expected, following fast tests are failing.

[  565s] FAILED dev_tools/bash_scripts_test.py::test_pytest_changed_files_file_selection
[  565s] FAILED dev_tools/bash_scripts_test.py::test_pytest_changed_files_branch_selection
[  565s] FAILED dev_tools/bash_scripts_test.py::test_pytest_and_incremental_coverage_branch_selection
[  565s] FAILED dev_tools/bash_scripts_test.py::test_incremental_format_branch_selection

verbose-pytest.log

0reactions
kevinsmia1939commented, Oct 20, 2020

Thanks, closing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

0.8.6: test suite is failing · Issue #139 · openSUSE/py2pack
The same error occurs if you want to use py2pack to search for a package. ... I've temporary didsabled using test suite on...
Read more >
commit python-wheel for openSUSE:Factory - The Mail Archive
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-wheel for openSUSE:Factory checked in at 2021-02-01 ......
Read more >
commit python-pexpect for openSUSE:Factory - openSUSE ...
Hello community,. here is the log from the commit of package python-pexpect for openSUSE:Factory checked in at 2019-05-27 08:37:25 ...
Read more >
python-pytest-test-3.10.1-bp151.1.1 - SUSE Package Hub
Fix collection of direct symlinked files, where the target does not match python_files. * Fix TypeError in report_collect with _collect_report_last_write.
Read more >
python3-tk-3.6.13-3.81.2.aarch64.rpm openSUSE 15.3 Download
Binary Package, https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.3/repo/oss/aarch64/python3-tk-3.6.13-3.81.2.aarch64.rpm.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found