Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging for openSUSE: TypeError and AssertionError #3154

Closed
kevinsmia1939 opened this issue Jul 19, 2020 · 13 comments
Closed

Packaging for openSUSE: TypeError and AssertionError #3154

kevinsmia1939 opened this issue Jul 19, 2020 · 13 comments
Labels
area/packages kind/bug-report Something doesn't seem to work. triage/needs-reproduction [bugs only] the bug was not provenly reproduced yet

Comments

@kevinsmia1939
Copy link

kevinsmia1939 commented Jul 19, 2020

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

@balopat
Copy link
Contributor

balopat commented Jul 20, 2020

@kevinsmia1939 I can't reproduce this just yet.
I tested on a virtual env with python 3.8 and your list of dependencies.

This might a difference between protobuf 3.12.2 and 3.12.3 but I doubt it based on a look at their commit log. For some reason protobuf 3.12.3 is not yet on PyPi - I haven't had success yet installing manually. How does openSUSE pull it in?

Can you try to reproduce this issue in a virtual env separately? That would help a lot.

The bash script tests are also odd that they are failing - maybe it is something related to SUSE?

@kevinsmia1939
Copy link
Author

@kevinsmia1939 I can't reproduce this just yet.
I tested on a virtual env with python 3.8 and your list of dependencies.

This might a difference between protobuf 3.12.2 and 3.12.3 but I doubt it based on a look at their commit log. For some reason protobuf 3.12.3 is not yet on PyPi - I haven't had success yet installing manually. How does openSUSE pull it in?

Can you try to reproduce this issue in a virtual env separately? That would help a lot.

The bash script tests are also odd that they are failing - maybe it is something related to SUSE?

Protobuf 3.12.3 is from github repo.
https://github.com/protocolbuffers/protobuf/releases/tag/v3.12.3

I will ask other packager and will keep you update,
Thanks.

@balopat balopat added kind/bug-report Something doesn't seem to work. triage/needs-reproduction [bugs only] the bug was not provenly reproduced yet labels Aug 13, 2020
@kevinsmia1939
Copy link
Author

kevinsmia1939 commented Aug 19, 2020

Hello,

An update.

I tried building Cirq from master branch instead of 0.8.2, some issues were solved.
Only bash_scripts_test.py failed. The rest of the issue is gone.
Also, I have to install pyquil and quimb as it is needed as dependencies for master branch.

[  402s] =================================== FAILURES ===================================
[  402s] ___________________ test_pytest_changed_files_file_selection ___________________
[  402s] 
[  402s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f9c69f7df10>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  402s] 
[  402s]     @only_on_posix
[  402s]     def test_pytest_changed_files_file_selection(tmpdir_factory):
[  402s]     
[  402s]         result = run(script_file='check/pytest-changed-files',
[  402s]                      tmpdir_factory=tmpdir_factory,
[  402s]                      arg='HEAD~1',
[  402s]                      setup='touch file.py\n'
[  402s]                      'git add -A\n'
[  402s]                      'git commit -m test --quiet --no-gpg-sign\n')
[  402s] >       assert result.exit_code == 0
[  402s] E       assert 1 == 0
[  402s] E         +1
[  402s] E         -0
[  402s] 
[  402s] dev_tools/bash_scripts_test.py:90: AssertionError
[  402s] __________________ test_pytest_changed_files_branch_selection __________________
[  402s] 
[  402s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f9c69f7df10>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  402s] 
[  402s]     @only_on_posix
[  402s]     def test_pytest_changed_files_branch_selection(tmpdir_factory):
[  402s]     
[  402s]         result = run(script_file='check/pytest-changed-files',
[  402s]                      tmpdir_factory=tmpdir_factory,
[  402s]                      arg='HEAD')
[  402s] >       assert result.exit_code == 0
[  402s] E       assert 1 == 0
[  402s] E         +1
[  402s] E         -0
[  402s] 
[  402s] dev_tools/bash_scripts_test.py:167: AssertionError
[  402s] ____________ test_pytest_and_incremental_coverage_branch_selection _____________
[  402s] 
[  402s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f9c69f7df10>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  402s] 
[  402s]     @only_on_posix
[  402s]     def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory):
[  402s]         result = run(script_file='check/pytest-and-incremental-coverage',
[  402s]                      tmpdir_factory=tmpdir_factory,
[  402s]                      arg='HEAD',
[  402s]                      additional_intercepts=['check/pytest'])
[  402s] >       assert result.exit_code == 0
[  402s] E       assert 1 == 0
[  402s] E         +1
[  402s] E         -0
[  402s] 
[  402s] dev_tools/bash_scripts_test.py:284: AssertionError
[  402s] ___________________ test_incremental_format_branch_selection ___________________
[  402s] 
[  402s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f9c69f7df10>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  402s] 
[  402s]     @only_on_posix
[  402s]     def test_incremental_format_branch_selection(tmpdir_factory):
[  402s]         result = run(script_file='check/format-incremental',
[  402s]                      tmpdir_factory=tmpdir_factory,
[  402s]                      arg='HEAD')
[  402s] >       assert result.exit_code == 0
[  402s] E       assert 1 == 0
[  402s] E         +1
[  402s] E         -0
[  402s] 
[  402s] dev_tools/bash_scripts_test.py:419: AssertionError
[  402s] ___________________ test_pylint_changed_files_file_selection ___________________
[  402s] 
[  402s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f9c69f7df10>, _basetemp=PosixPath('/tmp/pytest-of-abuild/pytest-0')))
[  402s] 
[  402s]     @only_on_posix
[  402s]     def test_pylint_changed_files_file_selection(tmpdir_factory):
[  402s]     
[  402s]         result = run(script_file='check/pylint-changed-files',
[  402s]                      tmpdir_factory=tmpdir_factory,
[  402s]                      arg='HEAD~1',
[  402s]                      setup='touch file.py\n'
[  402s]                      'git add -A\n'
[  402s]                      'git commit -m test --quiet --no-gpg-sign\n')
[  402s] >       assert result.exit_code == 0
[  402s] E       assert 1 == 0
[  402s] E         +1
[  402s] E         -0
[  402s] 
[  402s] dev_tools/bash_scripts_test.py:524: AssertionError

@balopat
Copy link
Contributor

balopat commented Aug 19, 2020

Thanks for the follow-up: pyquil and quimb should only be required by contrib. If you need contrib, you should install requirements from cirq/contrib/contrib-requirements.txt.

The bash tests are only testing the bash scripts for development - I think you could safely skip those, they will have no impact on the validity of the package.

@kevinsmia1939
Copy link
Author

Thanks for the follow-up: pyquil and quimb should only be required by contrib. If you need contrib, you should install requirements from cirq/contrib/contrib-requirements.txt.

The bash tests are only testing the bash scripts for development - I think you could safely skip those, they will have no impact on the validity of the package.

Thanks for info.
While bash script test is does not test validity of the package as you mention, skipping certain test must required some justification( at least in the practice of packaging for openSUSE ), I will ask openSUSE maintainer if it is acceptable and will keep you update.

@balopat
Copy link
Contributor

balopat commented Sep 25, 2020

@kevinsmia1939 do you have an update here?
Also, what is the entrypoint for the tests when you run them? We could potentially introduce something there to exclude dev tool tests.

@kevinsmia1939
Copy link
Author

@kevinsmia1939 do you have an update here?
Also, what is the entrypoint for the tests when you run them? We could potentially introduce something there to exclude dev tool tests.

Hi, I have not submit it to openSUSE python package maintainer yet since it is a master branch, they prefer a point release.
I have not tried the latest master yet since 19 Aug, but I will try the latest one today.
I can tell pytest to ignore the dev tool test with --ignore option. So not an issue if I need to exclude some test.
About the entry point, I will do it sometime today, afk at the moment.

@kevinsmia1939
Copy link
Author

kevinsmia1939 commented Sep 26, 2020

Does bash script test need any dependency?
I check and I do have bash installed as dependency just in case.

I'm not sure what you mean by entry point. But I think you mean where pytest was execute?

This log should give a full commands use to run pytest.

Do you have some suggestion to make Pytest more verbose?

[  152s] + cd /home/abuild/rpmbuild/BUILD
[  152s] + cd Cirq-master
[  152s] ++ '[' -f _current_flavor ']'
[  152s] ++ cat _current_flavor
[  152s] + python_flavor=python3
[  152s] + '[' -z python3 ']'
[  152s] + '[' python3 '!=' python3 ']'
[  152s] + echo python3
[  152s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-cirq-master-14.1.x86_64/usr/lib/python3.8/site-packages
[  152s] + PYTHONDONTWRITEBYTECODE=1
[  152s] + pytest-3.8 --ignore=_build.python2 --ignore=_build.python3 --ignore=_build.pypy3 -v
[  152s] ============================= test session starts ==============================
[  152s] platform linux -- Python 3.8.5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python3
[  152s] cachedir: .pytest_cache
[  152s] benchmark: 3.2.3 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
[  152s] rootdir: /home/abuild/rpmbuild/BUILD/Cirq-master
[  152s] plugins: benchmark-3.2.3, requests-mock-1.8.0, asyncio-0.14.0
[  215s] collecting ... collected 9246 items

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

@danchev
Copy link

danchev commented 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

@kevinsmia1939
Copy link
Author

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

@danchev
Thank you for the help. I hope this will be useful to @balopat .
By the way, how do you make pytest verbose?

@kevinsmia1939
Copy link
Author

I submit to openSUSE python repo, and they accept it but without any comments.

@balopat
Copy link
Contributor

balopat commented Oct 19, 2020

You can make pytest fully verbose by using -vvv.
The tests require git to be present.
The tests themselves create a temporary folder, run git init on it and test the scripts based on some changed files.
I think you can totally safely ignore these tests, they do not affect the quality of the package.

@kevinsmia1939
Copy link
Author

Thanks, closing this.

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 25, 2020
https://build.opensuse.org/request/show/841898
by user andythe_great + dimstar_suse
The test dev_tools/bash_scripts_test.py failed, I ask the dev but they could not reproduce the error, but the dev said that it does not effect the package validity so try to submit the package anyway.
quantumlib/Cirq#3154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/packages kind/bug-report Something doesn't seem to work. triage/needs-reproduction [bugs only] the bug was not provenly reproduced yet
Projects
None yet
Development

No branches or pull requests

3 participants