Skip to content

Commit

Permalink
Fixes an issue where the platform number would not cast to an int
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelduchesne committed Jan 28, 2020
1 parent eff447e commit 43e657a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/test_trnsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,20 @@ def test_trnbuild_idf_win32(config):


def get_platform():
"""Returns the MacOs release number as tuple of ints"""
"""Returns the MacOS release number as tuple of ints"""
import platform

release, versioninfo, machine = platform.mac_ver()
release_split = release.split(".")
return tuple(map(int, release_split))
return tuple(map(safe_int_cast, release_split))


def safe_int_cast(val, default=0):
"""Safely casts a value to an int"""
try:
return int(val)
except (ValueError, TypeError):
return default


@pytest.mark.darwin
Expand Down

0 comments on commit 43e657a

Please sign in to comment.