qiskit-community / qiskit-algorithms

A library of quantum algorithms for Qiskit.
https://qiskit-community.github.io/qiskit-algorithms/
Apache License 2.0
116 stars 59 forks source link

Fix test suite to account for beta numpy versions #70

Closed mgorny closed 1 year ago

mgorny commented 1 year ago

Summary

Fix the numpy version check in the test suite to account for the possibility that numpy.__version__ may contain letters.

Details and comments

Prior to this change, running tests on numpy 1.26.0b1 would result in the following error:

test/python/algorithms/optimizers/test_optimizers_scikitquant.py:72: in TestOptimizers
    tuple(map(int, numpy.__version__.split("."))) >= (1, 24, 0),
E   ValueError: invalid literal for int() with base 10: '0b1'

Since the third component is matched against zero, the simplest solution is to check only the first two components, since we can expect that the first two split elements will be integers.

This is synced from the equivalent qiskit change: https://github.com/Qiskit/qiskit/pull/10723

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 6014844995


Totals Coverage Status
Change from base Build 5964934865: 0.0%
Covered Lines: 6444
Relevant Lines: 7157

💛 - Coveralls
woodsp-ibm commented 1 year ago

@mgorny You will need to agree to the CLA here in qiskit-community organization too

mgorny commented 1 year ago

Done.

mgorny commented 1 year ago

Thanks!