Skip to content

Commit

Permalink
tests: improve detected version testing
Browse files Browse the repository at this point in the history
  • Loading branch information
P403n1x87 committed Aug 20, 2023
1 parent 59fd6f9 commit c9810e3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/test_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from itertools import takewhile
from subprocess import check_output

from test.utils import allpythons
Expand Down Expand Up @@ -127,8 +128,14 @@ def test_python_version(py):
meta = metadata(result.stdout)

reported_version = ".".join((str(_) for _ in meta["python"]))
actual_version = (
check_output([*python(py), "-V"]).decode().strip().partition(" ")[-1]

# Take the version from the interpreter itself, discarding anything after
# the patchlevel.
actual_version = "".join(
takewhile(
lambda _: _.isdigit() or _ == ".",
(check_output([*python(py), "-V"]).decode().strip().partition(" ")[-1]),
)
)

assert reported_version == actual_version, meta

0 comments on commit c9810e3

Please sign in to comment.