From 5130faac5110c549678a3eb67c3e5b7cb71dabe9 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 11:08:35 -0600 Subject: [PATCH 01/19] Updated plaform support for MacOS using arm64, and added x86_64 check for completeness --- src/pytestskipmarkers/utils/platform.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pytestskipmarkers/utils/platform.py b/src/pytestskipmarkers/utils/platform.py index 4ff84ba..f8addd4 100644 --- a/src/pytestskipmarkers/utils/platform.py +++ b/src/pytestskipmarkers/utils/platform.py @@ -112,6 +112,20 @@ def is_aarch64() -> bool: return platform.machine().startswith("aarch64") +def is_arm64() -> bool: + """ + Simple function to return if host is Arm64 or not. + """ + return platform.machine().startswith("arm64") + + +def is_x86_64() -> bool: + """ + Simple function to return if host is x86_64 or not. + """ + return platform.machine().startswith("x86_64") + + def is_photonos() -> bool: """ Simple function to return if host is Photon OS or not. From 79b2c7755e7211195b725a091352c380744c642b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 13:01:31 -0600 Subject: [PATCH 02/19] Added further support for arm64 --- src/pytestskipmarkers/utils/platform.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pytestskipmarkers/utils/platform.py b/src/pytestskipmarkers/utils/platform.py index f8addd4..5761969 100644 --- a/src/pytestskipmarkers/utils/platform.py +++ b/src/pytestskipmarkers/utils/platform.py @@ -152,6 +152,7 @@ def on_platforms( openbsd: bool = False, aix: bool = False, aarch64: bool = False, + arm64: bool = False, spawning: bool = False, photonos: bool = False, ) -> bool: @@ -168,6 +169,7 @@ def on_platforms( :keyword bool openbsd: When :py:const:`True`, check if running on OpenBSD. :keyword bool aix: When :py:const:`True`, check if running on AIX. :keyword bool aarch64: When :py:const:`True`, check if running on AArch64. + :keyword bool arm64: When :py:const:`True`, check if running on Arm64. :keyword bool spawning: When :py:const:`True`, check if running on a platform which defaults multiprocessing to spawn @@ -202,6 +204,9 @@ def on_platforms( if aarch64 and is_aarch64(): return True + if arm64 and is_arm64(): + return True + if spawning and is_spawning_platform(): return True From a97c5c94054eb329ce9c77246b6fca4c09c384cd Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 13:16:59 -0600 Subject: [PATCH 03/19] Updated pre-commit configuration --- .pre-commit-config.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65502e9..25692f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ minimum_pre_commit_version: 1.15.2 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-merge-conflict # Check for files that contain merge conflict strings. - id: trailing-whitespace # Trims trailing whitespace. @@ -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.0" hooks: - id: tools alias: actionlint @@ -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] - repo: https://github.com/asottile/reorder_python_imports - rev: v3.10.0 + rev: v3.13.0 hooks: - id: reorder-python-imports args: [ @@ -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 @@ -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 @@ -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)$ @@ -118,7 +118,7 @@ repos: - flake8-typing-imports - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.8.0 hooks: - id: mypy name: Run mypy against source @@ -131,7 +131,7 @@ repos: - types-setuptools - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.8.0 hooks: - id: mypy name: Run mypy against tests From e280e4bb9517655be1a3d2bad2f74e95bcc510a7 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 13:59:59 -0600 Subject: [PATCH 04/19] Added support for is_arm64 (MacOS), is_x86_64, and updated pre-commit --- .pre-commit-config.yaml | 14 +++++++------- .pre-commit-hooks/check-changelog-entries.py | 2 ++ changelog/36.improvement.rst | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 changelog/36.improvement.rst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 25692f2..e9fb583 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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.5.0 + rev: v4.6.0 hooks: - id: check-merge-conflict # Check for files that contain merge conflict strings. - id: trailing-whitespace # Trims trailing whitespace. @@ -37,7 +37,7 @@ repos: # <---- Local Hooks ------------------------------------------------------------------------------------------------ - repo: https://github.com/saltstack/python-tools-scripts - rev: "0.20.0" + rev: "0.20.5" hooks: - id: tools alias: actionlint @@ -118,26 +118,26 @@ repos: - flake8-typing-imports - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.11.0 hooks: - id: mypy name: Run mypy against source files: ^src/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ - args: [--strict] + args: [--strict, --python-version 3.8] additional_dependencies: - attrs - types-attrs - types-setuptools - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.11.0 hooks: - id: mypy name: Run mypy against tests files: ^tests/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ - args: [] + args: [--python-version 3.8] additional_dependencies: - pytest - attrs diff --git a/.pre-commit-hooks/check-changelog-entries.py b/.pre-commit-hooks/check-changelog-entries.py index 0d0eb8b..3b6a1ac 100755 --- a/.pre-commit-hooks/check-changelog-entries.py +++ b/.pre-commit-hooks/check-changelog-entries.py @@ -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: .improvement.rst + def check_changelog_entries(files): exitcode = 0 diff --git a/changelog/36.improvement.rst b/changelog/36.improvement.rst new file mode 100644 index 0000000..6e0cd2d --- /dev/null +++ b/changelog/36.improvement.rst @@ -0,0 +1 @@ +Added support for is_arm64 for MacOS and is_x86_64, and updated pre-commit From 69d68251976dc4d36fbfd1bde02471a76c95d1af Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 14:09:23 -0600 Subject: [PATCH 05/19] Fixing pre-commit issues --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e9fb583..40af05c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -124,7 +124,7 @@ repos: name: Run mypy against source files: ^src/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ - args: [--strict, --python-version 3.8] + args: [--strict, --python-version 3.8, --no-site-packages] additional_dependencies: - attrs - types-attrs @@ -137,7 +137,7 @@ repos: name: Run mypy against tests files: ^tests/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ - args: [--python-version 3.8] + args: [--python-version 3.8, --no-site-packages] additional_dependencies: - pytest - attrs From 5caa2c01d1681dc19923d88cbb99afcebba2f4a7 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 14:17:39 -0600 Subject: [PATCH 06/19] More pre-commit changes --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 40af05c..6fac8b2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -118,26 +118,26 @@ repos: - flake8-typing-imports - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.0 + rev: v1.4.1 hooks: - id: mypy name: Run mypy against source files: ^src/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ - args: [--strict, --python-version 3.8, --no-site-packages] + args: [--strict, --no-site-packages, --python-version 3.8] additional_dependencies: - attrs - types-attrs - types-setuptools - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.0 + rev: v1.4.1 hooks: - id: mypy name: Run mypy against tests files: ^tests/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ - args: [--python-version 3.8, --no-site-packages] + args: [--no-site-packages, --python-version 3.8] additional_dependencies: - pytest - attrs From c47c3cbf2dd53945f11963b1d50ce4cca979a65b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 14:26:10 -0600 Subject: [PATCH 07/19] Yet more pre-commit changes --- .pre-commit-config.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6fac8b2..4482531 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -124,7 +124,10 @@ repos: name: Run mypy against source files: ^src/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ - args: [--strict, --no-site-packages, --python-version 3.8] + args: + - --strict + - --no-site-packages + - --python-version 3.8 additional_dependencies: - attrs - types-attrs @@ -137,7 +140,9 @@ repos: name: Run mypy against tests files: ^tests/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ - args: [--no-site-packages, --python-version 3.8] + args: + - --no-site-packages + - --python-version 3.8 additional_dependencies: - pytest - attrs From 1ad2399a0e84f522181ee75106f82104f43c328f Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 14:31:01 -0600 Subject: [PATCH 08/19] pre-commit again --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4482531..46adb47 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -118,7 +118,7 @@ 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 @@ -134,7 +134,7 @@ repos: - 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 From 20b98c01312f968acc02be94ce000f1c6c056f92 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 14:45:31 -0600 Subject: [PATCH 09/19] Updated Python 3.7 to 3.8 --- setup.cfg | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 8357dd3..f127372 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 @@ -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 @@ -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 From 99fdc28fc15b3fe0314fc597bc31a94efbe24d08 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 14:50:50 -0600 Subject: [PATCH 10/19] pre-commit changes again --- .pre-commit-config.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46adb47..59af830 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -127,7 +127,6 @@ repos: args: - --strict - --no-site-packages - - --python-version 3.8 additional_dependencies: - attrs - types-attrs @@ -142,7 +141,6 @@ repos: exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ args: - --no-site-packages - - --python-version 3.8 additional_dependencies: - pytest - attrs From fee0b2edd48e729da62e8559dc61f4b9d8f43692 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 15:01:02 -0600 Subject: [PATCH 11/19] Drop support for Python 3.7 --- .pre-commit-config.yaml | 4 ++-- changelog/36.improvement.rst | 2 +- noxfile.py | 2 +- requirements/lint.txt | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59af830..c7709f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -54,8 +54,8 @@ repos: 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.13.0 diff --git a/changelog/36.improvement.rst b/changelog/36.improvement.rst index 6e0cd2d..6e07f58 100644 --- a/changelog/36.improvement.rst +++ b/changelog/36.improvement.rst @@ -1 +1 @@ -Added support for is_arm64 for MacOS and is_x86_64, and updated pre-commit +Added support for is_arm64 for MacOS and is_x86_64, and updated pre-commit, drop support for Python 3.7 diff --git a/noxfile.py b/noxfile.py index b11c933..37eb68e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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. diff --git a/requirements/lint.txt b/requirements/lint.txt index a5f5a7a..447eabc 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -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 From 6cac74b42483f275b9019461096151714dca4fea Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 09:14:54 -0600 Subject: [PATCH 12/19] Remove testing Python 3.7 from more locations --- .github/workflows/testing.yml | 3 --- docs/ref/pytestskipmarkers/plugin.rst | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 8a283c0..4c30542 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -111,7 +111,6 @@ jobs: max-parallel: 10 matrix: python-version: - - "3.7" - "3.8" - "3.9" - "3.10" @@ -186,7 +185,6 @@ jobs: max-parallel: 10 matrix: python-version: - - "3.7" - "3.8" - "3.9" - "3.10" @@ -263,7 +261,6 @@ jobs: max-parallel: 10 matrix: python-version: - - "3.7" - "3.8" - "3.9" - "3.10" diff --git a/docs/ref/pytestskipmarkers/plugin.rst b/docs/ref/pytestskipmarkers/plugin.rst index 9e08400..941cb01 100644 --- a/docs/ref/pytestskipmarkers/plugin.rst +++ b/docs/ref/pytestskipmarkers/plugin.rst @@ -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 From 575f5233f490df0546e848203b0a7fbdf252c2ed Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 09:31:47 -0600 Subject: [PATCH 13/19] Remove added is_arm64 - adjust is_aarch64 for Darwin, and remove is_x86_64 --- src/pytestskipmarkers/utils/platform.py | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/pytestskipmarkers/utils/platform.py b/src/pytestskipmarkers/utils/platform.py index 5761969..6c0f383 100644 --- a/src/pytestskipmarkers/utils/platform.py +++ b/src/pytestskipmarkers/utils/platform.py @@ -109,21 +109,11 @@ def is_aarch64() -> bool: """ Simple function to return if host is AArch64 or not. """ - return platform.machine().startswith("aarch64") - - -def is_arm64() -> bool: - """ - Simple function to return if host is Arm64 or not. - """ - return platform.machine().startswith("arm64") - - -def is_x86_64() -> bool: - """ - Simple function to return if host is x86_64 or not. - """ - return platform.machine().startswith("x86_64") + 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: @@ -152,7 +142,6 @@ def on_platforms( openbsd: bool = False, aix: bool = False, aarch64: bool = False, - arm64: bool = False, spawning: bool = False, photonos: bool = False, ) -> bool: @@ -169,7 +158,6 @@ def on_platforms( :keyword bool openbsd: When :py:const:`True`, check if running on OpenBSD. :keyword bool aix: When :py:const:`True`, check if running on AIX. :keyword bool aarch64: When :py:const:`True`, check if running on AArch64. - :keyword bool arm64: When :py:const:`True`, check if running on Arm64. :keyword bool spawning: When :py:const:`True`, check if running on a platform which defaults multiprocessing to spawn @@ -204,9 +192,6 @@ def on_platforms( if aarch64 and is_aarch64(): return True - if arm64 and is_arm64(): - return True - if spawning and is_spawning_platform(): return True From 6e021e2a47edc612f879d20fa26b9bd64a53fd2c Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 09:54:17 -0600 Subject: [PATCH 14/19] Updated tests for is_aarch64 returns --- changelog/36.improvement.rst | 2 +- tests/unit/utils/test_platform.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/changelog/36.improvement.rst b/changelog/36.improvement.rst index 6e07f58..acc0e03 100644 --- a/changelog/36.improvement.rst +++ b/changelog/36.improvement.rst @@ -1 +1 @@ -Added support for is_arm64 for MacOS and is_x86_64, and updated pre-commit, drop support for Python 3.7 +Updated is_aarch64 to allow for MacOS Arm64 using 'arm64' instead of 'aarch64', updated pre-commit, drop support for Python 3.7 diff --git a/tests/unit/utils/test_platform.py b/tests/unit/utils/test_platform.py index 7c860a2..e319f82 100644 --- a/tests/unit/utils/test_platform.py +++ b/tests/unit/utils/test_platform.py @@ -144,13 +144,21 @@ def test_is_not_aix(): def test_is_aarch64(): return_value = True - with mock.patch("platform.machine", return_value="aarch64"): + # Allow for MacOS Arm64 platform returns 'arm64' not 'aarch64', different than Linux + with mock.patch("platform.machine", return_value="arm64"): 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_aarch64"): + with mock.patch("platform.machine", return_value="not_arm64"): + assert pytestskipmarkers.utils.platform.is_aarch64() is return_value + + +def test_is_not_aarch64_string_aarch64(): + return_value = False + # Allow for MacOS Arm64 platform returning differently from Linux + with mock.patch("platform.machine", return_value="aarch64"): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value From 8a31aa54f26e1b37d76493a9404d26a8596f0dc0 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 10:04:16 -0600 Subject: [PATCH 15/19] Adjust aarch64 and arm64 testing --- tests/unit/utils/test_platform.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/unit/utils/test_platform.py b/tests/unit/utils/test_platform.py index e319f82..3cbd026 100644 --- a/tests/unit/utils/test_platform.py +++ b/tests/unit/utils/test_platform.py @@ -142,23 +142,32 @@ 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"): - assert pytestskipmarkers.utils.platform.is_aarch64() is return_value + with mock.patch("sys.platform", 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"): + with mock.patch("sys.platform", 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"): - assert pytestskipmarkers.utils.platform.is_aarch64() is return_value + with mock.patch("sys.platform", return_value="darwin"): + assert pytestskipmarkers.utils.platform.is_aarch64() is return_value def test_is_not_aarch64_string_aarch64(): return_value = False - # Allow for MacOS Arm64 platform returning differently from Linux - with mock.patch("platform.machine", return_value="aarch64"): + with mock.patch("platform.machine", return_value="not_aarch64"): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value From 760f373a59dac60b70e86be95af3214059e6e59f Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 10:15:50 -0600 Subject: [PATCH 16/19] Dubugging --- src/pytestskipmarkers/utils/platform.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pytestskipmarkers/utils/platform.py b/src/pytestskipmarkers/utils/platform.py index 6c0f383..623a6fc 100644 --- a/src/pytestskipmarkers/utils/platform.py +++ b/src/pytestskipmarkers/utils/platform.py @@ -111,9 +111,15 @@ def is_aarch64() -> bool: """ if is_darwin(): # Allow for MacOS Arm64 platform returning differently from Linux - return platform.machine().startswith("arm64") + # return platform.machine().startswith("arm64") + dgm_plmstrg = platform.machine() + print(f"DGM is_aarch64 with Darwin True, dgm_plmstrg '{dgm_plmstrg}'", flush=True) + return dgm_plmstrg.startswith("arm64") else: - return platform.machine().startswith("aarch64") + # return platform.machine().startswith("aarch64") + dgm_plmstrg = platform.machine() + print(f"DSGM is_aarch64 with Darwin False, dgm_plmstrg '{dgm_plmstrg}'", flush=True) + return dgm_plmstrg.startswith("aarch64") def is_photonos() -> bool: From d5b40038bc8480ec799afe96ecf6e2592f9656de Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 10:23:51 -0600 Subject: [PATCH 17/19] further debugging --- tests/unit/utils/test_platform.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/unit/utils/test_platform.py b/tests/unit/utils/test_platform.py index 3cbd026..0635014 100644 --- a/tests/unit/utils/test_platform.py +++ b/tests/unit/utils/test_platform.py @@ -144,14 +144,16 @@ def test_is_not_aix(): def test_is_aarch64_arm64(): return_value = True + print(f"DGM test_is_aarch64_arm64, expected return value '{return_value}'", flush=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", return_value="darwin"): + 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 + print(f"DGM test_is_aarch64_aarch64, expected return value '{return_value}'", flush=True) # Allow for MacOS Arm64 platform returns 'arm64' not 'aarch64', different than Linux with mock.patch("platform.machine", return_value="aarch64"): with mock.patch("sys.platform", return_value="not_darwin"): @@ -160,6 +162,7 @@ def test_is_aarch64_aarch64(): def test_is_not_aarch64(): return_value = False + print(f"DGM test_is_not_aarch64, expected return value '{return_value}'", flush=True) with mock.patch("platform.machine", return_value="not_arm64"): with mock.patch("sys.platform", return_value="darwin"): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value @@ -167,6 +170,10 @@ def test_is_not_aarch64(): def test_is_not_aarch64_string_aarch64(): return_value = False + print( + f"DGM test_is_not_aarch64_string_aarch64, expected return value '{return_value}'", + flush=True, + ) with mock.patch("platform.machine", return_value="not_aarch64"): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value From 777de7181f8150d640cec30391a7645e299f526d Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 10:29:18 -0600 Subject: [PATCH 18/19] More debugging --- tests/unit/utils/test_platform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/utils/test_platform.py b/tests/unit/utils/test_platform.py index 0635014..0dd426d 100644 --- a/tests/unit/utils/test_platform.py +++ b/tests/unit/utils/test_platform.py @@ -156,7 +156,7 @@ def test_is_aarch64_aarch64(): print(f"DGM test_is_aarch64_aarch64, expected return value '{return_value}'", flush=True) # Allow for MacOS Arm64 platform returns 'arm64' not 'aarch64', different than Linux with mock.patch("platform.machine", return_value="aarch64"): - with mock.patch("sys.platform", return_value="not_darwin"): + with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="not_darwin")): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value @@ -164,7 +164,7 @@ def test_is_not_aarch64(): return_value = False print(f"DGM test_is_not_aarch64, expected return value '{return_value}'", flush=True) with mock.patch("platform.machine", return_value="not_arm64"): - with mock.patch("sys.platform", return_value="darwin"): + with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="darwin")): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value From bbdae79ce5694f5a35a65569d9dccdba2384c47a Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 10:34:45 -0600 Subject: [PATCH 19/19] Removed debug statements --- src/pytestskipmarkers/utils/platform.py | 10 ++-------- tests/unit/utils/test_platform.py | 7 ------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/pytestskipmarkers/utils/platform.py b/src/pytestskipmarkers/utils/platform.py index 623a6fc..6c0f383 100644 --- a/src/pytestskipmarkers/utils/platform.py +++ b/src/pytestskipmarkers/utils/platform.py @@ -111,15 +111,9 @@ def is_aarch64() -> bool: """ if is_darwin(): # Allow for MacOS Arm64 platform returning differently from Linux - # return platform.machine().startswith("arm64") - dgm_plmstrg = platform.machine() - print(f"DGM is_aarch64 with Darwin True, dgm_plmstrg '{dgm_plmstrg}'", flush=True) - return dgm_plmstrg.startswith("arm64") + return platform.machine().startswith("arm64") else: - # return platform.machine().startswith("aarch64") - dgm_plmstrg = platform.machine() - print(f"DSGM is_aarch64 with Darwin False, dgm_plmstrg '{dgm_plmstrg}'", flush=True) - return dgm_plmstrg.startswith("aarch64") + return platform.machine().startswith("aarch64") def is_photonos() -> bool: diff --git a/tests/unit/utils/test_platform.py b/tests/unit/utils/test_platform.py index 0dd426d..4820ae5 100644 --- a/tests/unit/utils/test_platform.py +++ b/tests/unit/utils/test_platform.py @@ -144,7 +144,6 @@ def test_is_not_aix(): def test_is_aarch64_arm64(): return_value = True - print(f"DGM test_is_aarch64_arm64, expected return value '{return_value}'", flush=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")): @@ -153,7 +152,6 @@ def test_is_aarch64_arm64(): def test_is_aarch64_aarch64(): return_value = True - print(f"DGM test_is_aarch64_aarch64, expected return value '{return_value}'", flush=True) # Allow for MacOS Arm64 platform returns 'arm64' not 'aarch64', different than Linux with mock.patch("platform.machine", return_value="aarch64"): with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="not_darwin")): @@ -162,7 +160,6 @@ def test_is_aarch64_aarch64(): def test_is_not_aarch64(): return_value = False - print(f"DGM test_is_not_aarch64, expected return value '{return_value}'", flush=True) 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 @@ -170,10 +167,6 @@ def test_is_not_aarch64(): def test_is_not_aarch64_string_aarch64(): return_value = False - print( - f"DGM test_is_not_aarch64_string_aarch64, expected return value '{return_value}'", - flush=True, - ) with mock.patch("platform.machine", return_value="not_aarch64"): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value