qiskit-aer icon indicating copy to clipboard operation
qiskit-aer copied to clipboard

All tests fail: AttributeError: 'TestParameterizedQobj' object has no attribute 'useFixture'

Open yurivict opened this issue 1 year ago • 1 comments

Informations

  • Qiskit Aer version: 021faf8
  • Python version: 3.9
  • Operating system: FreeBSD 13.1

What is the current behavior?

========================================================================================== FAILURES ==========================================================================================
_________________________________________________________________________ TestPythonToCpp.test_evaluate_hamiltonians _________________________________________________________________________
/usr/local/lib/python3.9/site-packages/qiskit/utils/classtools.py:117: in out
    retval = method(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test.terra.test_python_to_cpp.TestPythonToCpp testMethod=test_evaluate_hamiltonians>

    def setUp(self):
        super().setUp()
>       self.useFixture(fixtures.Timeout(120, gentle=False))
E       AttributeError: 'TestPythonToCpp' object has no attribute 'useFixture'

test/terra/common.py:49: AttributeError
________________________________________________________________________ TestPythonToCpp.test_np_2D_array_of_doubles _________________________________________________________________________
/usr/local/lib/python3.9/site-packages/qiskit/utils/classtools.py:117: in out
    retval = method(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test.terra.test_python_to_cpp.TestPythonToCpp testMethod=test_np_2D_array_of_doubles>

    def setUp(self):
        super().setUp()
>       self.useFixture(fixtures.Timeout(120, gentle=False))
E       AttributeError: 'TestPythonToCpp' object has no attribute 'useFixture'

test/terra/common.py:49: AttributeError
__________________________________________________________________________ TestPythonToCpp.test_np_array_of_doubles __________________________________________________________________________
/usr/local/lib/python3.9/site-packages/qiskit/utils/classtools.py:117: in out
    retval = method(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test.terra.test_python_to_cpp.TestPythonToCpp testMethod=test_np_array_of_doubles>

    def setUp(self):
        super().setUp()
>       self.useFixture(fixtures.Timeout(120, gentle=False))
E       AttributeError: 'TestPythonToCpp' object has no attribute 'useFixture'

test/terra/common.py:49: AttributeError
____________________________________________ TestPythonToCpp.test_py_dict_string_list_of_list_of_doubles_to_cpp_map_string_vec_of_vecs_of_doubles ____________________________________________
/usr/local/lib/python3.9/site-packages/qiskit/utils/classtools.py:117: in out
    retval = method(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test.terra.test_python_to_cpp.TestPythonToCpp testMethod=test_py_dict_string_list_of_list_of_doubles_to_cpp_map_string_vec_of_vecs_of_doubles>

    def setUp(self):
        super().setUp()
>       self.useFixture(fixtures.Timeout(120, gentle=False))
E       AttributeError: 'TestPythonToCpp' object has no attribute 'useFixture'

test/terra/common.py:49: AttributeError
___________________________________________________________ TestPythonToCpp.test_py_dict_string_numeric_to_cpp_map_string_numeric ____________________________________________________________

Steps to reproduce the problem

regular build/tests

What is the expected behavior?

n/a

Suggested solutions

n/a

yurivict avatar Aug 09 '22 06:08 yurivict

When you say "regular build/tests", what do you mean? How did you run the tests? It's quite possible an immediate workaround for you is to install testtools as an additional package.

@mtreinish: looks like Aer is using some testtools-specific functionality, so we should probably either bite the bullet and add it to requirements-dev.txt for Aer only, or gate the test case that requires useFixtures behind an optionals.require_in_instance("testtools") call. It's certainly doing weird stuff by directly importing FullQiskitTestCase, which probably shouldn't be accessible unless testtools is installed.

jakelishman avatar Aug 16 '22 02:08 jakelishman

Let me close this issue because no response since 1 year.

hhorii avatar May 16 '23 12:05 hhorii