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

Updated platform support for MacOS using arm64 in function is_aarch64 #36

Merged
merged 19 commits into from
Aug 9, 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
3 changes: 0 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ jobs:
max-parallel: 10
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -186,7 +185,6 @@ jobs:
max-parallel: 10
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -263,7 +261,6 @@ jobs:
max-parallel: 10
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down
39 changes: 21 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
minimum_pre_commit_version: 1.15.2
minimum_pre_commit_version: 3.6.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: trailing-whitespace # Trims trailing whitespace.
Expand Down Expand Up @@ -36,8 +36,8 @@ repos:
language: system
# <---- Local Hooks ------------------------------------------------------------------------------------------------

- repo: https://github.com/s0undt3ch/python-tools-scripts
rev: "0.17.0"
- repo: https://github.com/saltstack/python-tools-scripts
rev: "0.20.5"
hooks:
- id: tools
alias: actionlint
Expand All @@ -51,14 +51,14 @@ repos:

# ----- Formatting ------------------------------------------------------------------------------------------------>
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.1
hooks:
- id: pyupgrade
name: Rewrite Code to be Py3.7+
args: [--py37-plus]
name: Rewrite Code to be Py3.8+
args: [--py38-plus]

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
rev: v3.13.0
hooks:
- id: reorder-python-imports
args: [
Expand All @@ -68,25 +68,25 @@ repos:
exclude: ^src/pytestskipmarkers/(version.py|downgraded/.*)$

- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.2.0
hooks:
- id: black
args: [-l 100]
exclude: ^src/pytestskipmarkers/(version.py|downgraded/.*)$

- repo: https://github.com/asottile/blacken-docs
rev: 1.15.0
rev: 1.16.0
hooks:
- id: blacken-docs
args: [--skip-errors]
files: ^(.*\.rst|docs/.*\.rst|src/pytestskipmarkers/.*\.py)$
additional_dependencies:
- black==23.7.0
- black==24.2.0
# <---- Formatting -------------------------------------------------------------------------------------------------

# ----- Security -------------------------------------------------------------------------------------------------->
- repo: https://github.com/PyCQA/bandit
rev: "1.7.5"
rev: "1.7.7"
hooks:
- id: bandit
alias: bandit-salt
Expand All @@ -97,7 +97,7 @@ repos:
tests/.*
)$
- repo: https://github.com/PyCQA/bandit
rev: "1.7.5"
rev: "1.7.7"
hooks:
- id: bandit
alias: bandit-tests
Expand All @@ -108,7 +108,7 @@ repos:

# ----- Code Analysis --------------------------------------------------------------------------------------------->
- repo: https://github.com/pycqa/flake8
rev: '6.1.0'
rev: '7.1.1'
hooks:
- id: flake8
exclude: ^(src/pytestskipmarkers/(downgraded/.*|version\.py)|\.pre-commit-hooks/.*\.py)$
Expand All @@ -118,26 +118,29 @@ repos:
- flake8-typing-imports

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.11.1
hooks:
- id: mypy
name: Run mypy against source
files: ^src/.*\.py$
exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$
args: [--strict]
args:
- --strict
- --no-site-packages
additional_dependencies:
- attrs
- types-attrs
- types-setuptools

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.11.1
hooks:
- id: mypy
name: Run mypy against tests
files: ^tests/.*\.py$
exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$
args: []
args:
- --no-site-packages
additional_dependencies:
- pytest
- attrs
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-hooks/check-changelog-entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
CHANGELOG_ENTRY_REREX = r"^[\d]+\.({})\.rst$".format("|".join(CHANGELOG_EXTENSIONS))
CHANGELOG_ENTRY_RE = re.compile(CHANGELOG_ENTRY_REREX)

## Example changelog entry: <PR number>.improvement.rst


def check_changelog_entries(files):
exitcode = 0
Expand Down
1 change: 1 addition & 0 deletions changelog/36.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated is_aarch64 to allow for MacOS Arm64 using 'arm64' instead of 'aarch64', updated pre-commit, drop support for Python 3.7
2 changes: 1 addition & 1 deletion docs/ref/pytestskipmarkers/plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Markers
assert True


@pytest.mark.skip_if_binaries_missing("python3.7", "python3", "python", check_all=False)
@pytest.mark.skip_if_binaries_missing("python3.8", "python3", "python", check_all=False)
def test_func():
assert True

Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def session_run_always(session, *command, **kwargs):
session._runner.global_config.install_only = old_install_only_value


@nox.session(python=("3", "3.5", "3.6", "3.7", "3.8", "3.9"))
@nox.session(python=("3", "3.8", "3.9", "3.10"))
def tests(session):
"""
Run tests.
Expand Down
4 changes: 2 additions & 2 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-r tests.txt
pylint==2.12.2
pyenchant
black; python_version >= '3.7'
reorder-python-imports; python_version >= '3.7'
black; python_version >= '3.8'
reorder-python-imports; python_version >= '3.8'
flake8 >= 4.0.1
flake8-mypy-fork
flake8-docstrings
Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ classifiers =
Programming Language :: Cython
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -35,7 +34,7 @@ include_package_data = True
package_dir =
=src
packages = find:
python_requires = >= 3.7
python_requires = >= 3.8
setup_requires =
setuptools>=50.3.2
setuptools_scm[toml]>=3.4
Expand Down Expand Up @@ -133,7 +132,7 @@ docstring-convention = google


[mypy]
python_version = 3.7
python_version = 3.8
mypy_path = src
ignore_missing_imports = True
no_implicit_optional = True
Expand Down
6 changes: 5 additions & 1 deletion src/pytestskipmarkers/utils/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ def is_aarch64() -> bool:
"""
Simple function to return if host is AArch64 or not.
"""
return platform.machine().startswith("aarch64")
if is_darwin():
# Allow for MacOS Arm64 platform returning differently from Linux
return platform.machine().startswith("arm64")
else:
return platform.machine().startswith("aarch64")


def is_photonos() -> bool:
Expand Down
21 changes: 19 additions & 2 deletions tests/unit/utils/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,30 @@ def test_is_not_aix():
assert pytestskipmarkers.utils.platform.is_aix() is return_value


def test_is_aarch64():
def test_is_aarch64_arm64():
return_value = True
# Allow for MacOS Arm64 platform returns 'arm64' not 'aarch64', different than Linux
with mock.patch("platform.machine", return_value="arm64"):
with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="darwin")):
assert pytestskipmarkers.utils.platform.is_aarch64() is return_value


def test_is_aarch64_aarch64():
return_value = True
# Allow for MacOS Arm64 platform returns 'arm64' not 'aarch64', different than Linux
with mock.patch("platform.machine", return_value="aarch64"):
assert pytestskipmarkers.utils.platform.is_aarch64() is return_value
with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="not_darwin")):
assert pytestskipmarkers.utils.platform.is_aarch64() is return_value


def test_is_not_aarch64():
return_value = False
with mock.patch("platform.machine", return_value="not_arm64"):
with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="darwin")):
assert pytestskipmarkers.utils.platform.is_aarch64() is return_value


def test_is_not_aarch64_string_aarch64():
return_value = False
with mock.patch("platform.machine", return_value="not_aarch64"):
assert pytestskipmarkers.utils.platform.is_aarch64() is return_value
Expand Down
Loading