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

Update dummy runtimes #460

Merged
merged 11 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ jobs:
strategy:
matrix:
python-version: [3.6, 3.8]
os: [ubuntu-20.04, macos-11, windows-2019]
os: [ubuntu-20.04, macos-12, macos-latest, windows-2019]
exclude:
- os: macos-latest
python-version: 3.6
runs-on: ${{ matrix.os }}
needs: code-lint
steps:
Expand Down
6 changes: 3 additions & 3 deletions okonomiyaki/platforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from .abi import PlatformABI, default_abi
from .epd_platform import EPDPlatform, applies
from ._platform import Platform, OSKind, FamilyKind, NameKind
from ._arch import X86, X86_64
from ._arch import X86, X86_64, ARM64
from .pep425 import compute_abi_tag, compute_python_tag, compute_platform_tag
from .python_implementation import PythonABI, PythonImplementation


__all__ = [
"X86", "X86_64", "EPDPlatform", "Platform", "PythonImplementation",
"default_abi"
'X86', 'X86_64', 'ARM64', 'EPDPlatform', 'Platform', 'PythonImplementation',
'default_abi'
]
15 changes: 5 additions & 10 deletions okonomiyaki/runtimes/tests/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def test_simple_from_running_python(self):

@unittest.skipIf(
hasattr(sys, "pypy_version_info"),
"This test is only supported on cpython"
)
"This test is only supported on cpython")
def test_from_prefix_and_platform(self):
# Given
prefix = u"/usr/local"
Expand All @@ -34,8 +33,7 @@ def test_from_prefix_and_platform(self):

# When
runtime = PythonRuntime.from_prefix_and_platform(
prefix, platform, version
)
prefix, platform, version)
runtime_info = runtime._runtime_info

# Then
Expand All @@ -56,8 +54,7 @@ def test_from_prefix_and_platform(self):

# When
runtime = PythonRuntime.from_prefix_and_platform(
prefix, platform, version
)
prefix, platform, version)

# Then
self.assertEqual(runtime.prefix, prefix)
Expand All @@ -73,8 +70,7 @@ def test_from_prefix_and_platform(self):

# When
runtime = PythonRuntime.from_prefix_and_platform(
prefix, platform, version
)
prefix, platform, version)

# Then
self.assertEqual(runtime.prefix, prefix)
Expand All @@ -91,8 +87,7 @@ def test_normalization(self):

# When
runtime_info = PythonRuntime.from_prefix_and_platform(
prefix, platform, version
)
prefix, platform, version)

# Then
self.assertEqual(runtime_info.prefix, norm_prefix)
Expand Down
21 changes: 7 additions & 14 deletions okonomiyaki/runtimes/tests/test_runtime_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def test_simple(self):

# When
runtime_info = IRuntimeInfo.factory_from_metadata(
metadata, prefix, name
)
metadata, prefix, name)

# Then
self.assertEqual(runtime_info.prefix, prefix)
Expand All @@ -52,8 +51,7 @@ def test_dollar_in_prefix(self):

# When
runtime_info = IRuntimeInfo.factory_from_metadata(
metadata, prefix, name
)
metadata, prefix, name)

# Then
self.assertEqual(runtime_info.prefix, prefix)
Expand All @@ -70,13 +68,11 @@ def test_json_round_trip(self):
prefix = os.path.abspath(os.path.join(u"foo", u"bar"))

r_runtime_info = IRuntimeInfo.factory_from_metadata(
metadata, prefix, name
)
metadata, prefix, name)

# When
runtime_info = IRuntimeInfo.factory_from_json_dict(
r_runtime_info.to_json_dict()
)
r_runtime_info.to_json_dict())

# Then
self.assertEqual(runtime_info, r_runtime_info)
Expand All @@ -99,8 +95,7 @@ def test_simple(self):

# When
runtime_info = IRuntimeInfo.factory_from_metadata(
metadata, prefix, name
)
metadata, prefix, name)

# Then
self.assertEqual(runtime_info.prefix, prefix)
Expand All @@ -117,13 +112,11 @@ def test_json_round_trip(self):
prefix = os.path.abspath(os.path.join(u"foo", u"bar"))

r_runtime_info = IRuntimeInfo.factory_from_metadata(
metadata, prefix, name
)
metadata, prefix, name)

# When
runtime_info = IRuntimeInfo.factory_from_json_dict(
r_runtime_info.to_json_dict()
)
r_runtime_info.to_json_dict())

# Then
self.assertEqual(runtime_info, r_runtime_info)
55 changes: 26 additions & 29 deletions okonomiyaki/runtimes/tests/test_runtime_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import unittest

import zipfile2
from hypothesis import given
from hypothesis.strategies import sampled_from
from parameterized import parameterized


from okonomiyaki.errors import (
Expand All @@ -14,12 +13,14 @@
INVALID_RUNTIME_NO_METADATA_VERSION, JULIA_DEFAULT_0_3_11_RH5_X86_64,
PYTHON_CPYTHON_2_7_10_RH5_X86_64, PYTHON_CPYTHON_2_7_10_RH5_X86_64_INVALID,
PYTHON_PYPY_2_6_0_RH5_X86_64, R_DEFAULT_3_0_0_RH5_X86_64,
PYTHON_CPYTHON_3_11_2_OSX_ARM64, PYTHON_CPYTHON_3_11_2_RH8_ARM64,
PYTHON_CPYTHON_3_8_8_RH7_X86_64, PYTHON_CPYTHON_3_8_8_OSX_X86_64,
PYTHON_CPYTHON_3_8_8_WIN_X86_64, PYTHON_CPYTHON_3_8_8_WIN_X86,
PYTHON_CPYTHON_3_11_2_RH8_X86_64, PYTHON_CPYTHON_3_11_2_OSX_X86_64,
PYTHON_CPYTHON_3_11_2_WIN_X86_64)
from okonomiyaki.versions import MetadataVersion
from okonomiyaki.platforms import Platform, OSKind, FamilyKind, NameKind, X86_64, X86
from okonomiyaki.platforms import (
Platform, OSKind, FamilyKind, NameKind, X86_64, X86, ARM64)

from ..runtime_metadata import (
JuliaRuntimeMetadataV1, PythonRuntimeMetadataV1, RuntimeVersion,
Expand Down Expand Up @@ -104,14 +105,13 @@ def test_invalid(self):
with self.assertRaises(InvalidMetadata):
PythonRuntimeMetadataV1._from_path(zp)

@given(
sampled_from([
(PYTHON_CPYTHON_2_7_10_RH5_X86_64, '2.7.10+1', '5.8'),
(PYTHON_CPYTHON_3_8_8_RH7_X86_64, '3.8.8+1', '7.1'),
(PYTHON_CPYTHON_3_11_2_RH8_X86_64, '3.11.2+2', '8.8')]))
def test_cpython_gnu(self, options):
@parameterized.expand([
(PYTHON_CPYTHON_2_7_10_RH5_X86_64, '2.7.10+1', '5.8', X86_64),
(PYTHON_CPYTHON_3_8_8_RH7_X86_64, '3.8.8+1', '7.1', X86_64),
(PYTHON_CPYTHON_3_11_2_RH8_X86_64, '3.11.2+2', '8.8', X86_64),
(PYTHON_CPYTHON_3_11_2_RH8_ARM64, '3.11.2+2', '8.8', ARM64)])
def test_cpython_gnu(self, path, release, os_release, arch):
# Given
path, release, os_release = options
version = RuntimeVersion.from_string(release.split('+')[0])
release = RuntimeVersion.from_string(release)
lib = '${{prefix}}/lib/python{0}.{1}'.format(version.major, version.minor)
Expand Down Expand Up @@ -145,16 +145,15 @@ def test_cpython_gnu(self, options):
family_kind=FamilyKind.rhel,
name_kind=NameKind.rhel,
release=os_release,
arch=X86_64,
machine=X86_64))

@given(
sampled_from([
(PYTHON_CPYTHON_3_8_8_OSX_X86_64, '3.8.8+1', '10.14'),
(PYTHON_CPYTHON_3_11_2_OSX_X86_64, '3.11.2+2', '12.0')]))
def test_cpython_darwin(self, options):
arch=arch,
machine=arch))

@parameterized.expand([
(PYTHON_CPYTHON_3_8_8_OSX_X86_64, '3.8.8+1', '10.14', X86_64),
(PYTHON_CPYTHON_3_11_2_OSX_ARM64, '3.11.2+2', '12.0', ARM64),
(PYTHON_CPYTHON_3_11_2_OSX_X86_64, '3.11.2+2', '12.0', X86_64)])
def test_cpython_darwin(self, path, release, os_release, arch):
# Given
path, release, os_release = options
version = RuntimeVersion.from_string(release.split('+')[0])
release = RuntimeVersion.from_string(release)
lib = '${{prefix}}/lib/python{0}.{1}'.format(version.major, version.minor)
Expand Down Expand Up @@ -188,17 +187,15 @@ def test_cpython_darwin(self, options):
family_kind=FamilyKind.mac_os_x,
name_kind=NameKind.mac_os_x,
release=os_release,
arch=X86_64,
machine=X86_64))

@given(
sampled_from([
(PYTHON_CPYTHON_3_11_2_WIN_X86_64, '3.11.2+2', '10', X86_64),
(PYTHON_CPYTHON_3_8_8_WIN_X86_64, '3.8.8+1', '10', X86_64),
(PYTHON_CPYTHON_3_8_8_WIN_X86, '3.8.8+1', '10', X86)]))
def test_cpython_windows(self, options):
arch=arch,
machine=arch))

@parameterized.expand([
(PYTHON_CPYTHON_3_11_2_WIN_X86_64, '3.11.2+2', '10', X86_64),
(PYTHON_CPYTHON_3_8_8_WIN_X86_64, '3.8.8+1', '10', X86_64),
(PYTHON_CPYTHON_3_8_8_WIN_X86, '3.8.8+1', '10', X86)])
def test_cpython_windows(self, path, release, os_release, arch):
# Given
path, release, os_release, arch = options
version = RuntimeVersion.from_string(release.split('+')[0])
release = RuntimeVersion.from_string(release)
tag = 'cp{0}{1}'.format(version.major, version.minor)
Expand Down
Loading
Loading