diff --git a/recipes-devtools/python/files/python_dependency_test.py b/recipes-devtools/python/files/python_dependency_test.py new file mode 100644 index 0000000000..e6fd51c488 --- /dev/null +++ b/recipes-devtools/python/files/python_dependency_test.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +"""Reusable Python dependency compatibility testing library""" + +import pkg_resources +import sys +import os + +def test_package_requirements(package_name): + """Test that a package's requirements are satisfied""" + try: + # Import the package + __import__(package_name.replace('-', '_')) + print(f"PASS: {package_name} import successful") + + # Get package distribution and requirements + dist = pkg_resources.get_distribution(package_name) + requirements = dist.requires() + + print(f"{package_name} version: {dist.version}") + + if not requirements: + print(f"PASS: {package_name} has no dependencies to check") + return True + + # Check each requirement + for req in requirements: + try: + pkg_resources.require(str(req)) + print(f"PASS: {req} satisfied") + except pkg_resources.DistributionNotFound: + print(f"FAIL: {req} not found") + return False + except pkg_resources.VersionConflict as e: + print(f"FAIL: {req} version conflict: {e}") + return False + + return True + except Exception as e: + print(f"FAIL: {package_name} test failed: {e}") + return False + +def get_python_rdepends_from_env(): + """Extract Python dependencies from RDEPENDS environment variable""" + rdepends = os.environ.get('RDEPENDS', '') + python_deps = [] + + for dep in rdepends.split(): + if dep.startswith('python3-') and not dep.endswith('-native'): + pkg_name = dep.replace('python3-', '') + python_deps.append(pkg_name) + + return python_deps + +def test_integration_with(package_name, integration_packages): + """Test integration with other packages""" + success = True + + for integration_pkg in integration_packages: + try: + __import__(package_name.replace('-', '_')) + __import__(integration_pkg.replace('-', '_')) + print(f"PASS: {package_name} integrates with {integration_pkg}") + except ImportError: + print(f"SKIP: {integration_pkg} not available") + except Exception as e: + print(f"FAIL: {package_name}-{integration_pkg} integration failed: {e}") + success = False + + return success + +def main(): + """Main test function""" + if len(sys.argv) < 2: + print("FAIL: Package name required as argument") + return 1 + + package_name = sys.argv[1] + print(f"=== Testing {package_name} dependency compatibility ===") + + success = True + success &= test_package_requirements(package_name) + + # Get integration packages from RDEPENDS + integration_packages = get_python_rdepends_from_env() + if integration_packages: + print(f"Found Python dependencies from RDEPENDS: {integration_packages}") + success &= test_integration_with(package_name, integration_packages) + + # Always output final result + if success: + print(f"PASS: {package_name} dependency test completed successfully") + else: + print(f"FAIL: {package_name} dependency test failed") + + return 0 if success else 1 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/recipes-devtools/python/python3-boto3/run-ptest b/recipes-devtools/python/python3-boto3/run-ptest index d370e1c4f0..132a7ad606 100644 --- a/recipes-devtools/python/python3-boto3/run-ptest +++ b/recipes-devtools/python/python3-boto3/run-ptest @@ -1,2 +1,7 @@ #!/bin/sh + +# Test dependency conflicts using shared library +python3 python_dependency_test.py boto3 + +# Run original smoke tests pytest tests/functional/test_smoke.py -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'| sed -e 's/SKIPPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}' diff --git a/recipes-devtools/python/python3-boto3_1.37.38.bb b/recipes-devtools/python/python3-boto3_1.40.49.bb similarity index 78% rename from recipes-devtools/python/python3-boto3_1.37.38.bb rename to recipes-devtools/python/python3-boto3_1.40.49.bb index 4ff2c9a6e5..6b62d36dcb 100644 --- a/recipes-devtools/python/python3-boto3_1.37.38.bb +++ b/recipes-devtools/python/python3-boto3_1.40.49.bb @@ -4,11 +4,15 @@ HOMEPAGE = "https://github.com/boto/boto3" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" +FILESEXTRAPATHS:prepend := "${THISDIR}/../files:" + SRC_URI = "\ git://github.com/boto/boto3.git;protocol=https;branch=master \ - file://run-ptest" + file://run-ptest \ + file://python_dependency_test.py \ + " -SRCREV = "3f98cd0ed5dc41957e2303a3473b1249b8f4a7c4" +SRCREV = "660a1ec6b8b97d109a8ab37ca5a79925844388f0" S = "${UNPACKDIR}/git" inherit setuptools3 ptest @@ -29,4 +33,5 @@ RDEPENDS:${PN}-ptest += "\ do_install_ptest() { install -d ${D}${PTEST_PATH}/tests cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/ + install -m 0755 ${UNPACKDIR}/python_dependency_test.py ${D}${PTEST_PATH}/ } diff --git a/recipes-devtools/python/python3-botocore/run-ptest b/recipes-devtools/python/python3-botocore/run-ptest index 86d90e1414..146a9a0058 100644 --- a/recipes-devtools/python/python3-botocore/run-ptest +++ b/recipes-devtools/python/python3-botocore/run-ptest @@ -1,2 +1,9 @@ #!/bin/sh -pytest tests/integration/test_loaders.py -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'| sed -e 's/SKIPPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}' + +# Test dependency conflicts using shared library +python3 python_dependency_test.py botocore + +# Run basic botocore tests (if any exist) +if [ -d tests/unit ]; then + pytest tests/unit/test_client.py -v 2>/dev/null || echo "SKIP: unit tests not available" +fi diff --git a/recipes-devtools/python/python3-botocore_1.37.38.bb b/recipes-devtools/python/python3-botocore_1.40.49.bb similarity index 76% rename from recipes-devtools/python/python3-botocore_1.37.38.bb rename to recipes-devtools/python/python3-botocore_1.40.49.bb index 4f7eed7a40..0a23788924 100644 --- a/recipes-devtools/python/python3-botocore_1.37.38.bb +++ b/recipes-devtools/python/python3-botocore_1.40.49.bb @@ -4,12 +4,15 @@ HOMEPAGE = "https://github.com/boto/botocore" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=2ee41112a44fe7014dce33e26468ba93" +FILESEXTRAPATHS:prepend := "${THISDIR}/../files:" + SRC_URI = "\ git://github.com/boto/botocore.git;protocol=https;branch=master \ file://run-ptest \ + file://python_dependency_test.py \ " -SRCREV = "2a882881e2f02f8959df7b551978005854f8f5dd" +SRCREV = "dc8eb09cd30fb3fe1259c98a2a2f7955dc700227" S = "${UNPACKDIR}/git" inherit setuptools3 ptest @@ -28,4 +31,5 @@ RDEPENDS:${PN}-ptest += "\ do_install_ptest() { install -d ${D}${PTEST_PATH}/tests cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/ + install -m 0755 ${UNPACKDIR}/python_dependency_test.py ${D}${PTEST_PATH}/ } diff --git a/recipes-devtools/python/python3-s3transfer/run-ptest b/recipes-devtools/python/python3-s3transfer/run-ptest index 3bc1c08b54..fae9238577 100644 --- a/recipes-devtools/python/python3-s3transfer/run-ptest +++ b/recipes-devtools/python/python3-s3transfer/run-ptest @@ -1,6 +1,9 @@ #!/bin/sh -# known good tests +# Test dependency conflicts using shared library +python3 python_dependency_test.py s3transfer botocore multiprocessing urllib3 boto3 + +# Run original unit tests TESTS="\ unit/test_bandwidth.py \ unit/test_compat.py \ @@ -11,15 +14,3 @@ for TEST in $TESTS do pytest tests/$TEST -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'| sed -e 's/SKIPPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}' done - -#disabled tests -# unit/test_delete.py -# unit/test_download.py -# unit/test_futures.py -# unit/test_manager.py -# unit/test_processpool.py -# unit/test_s3transfer.py -# unit/test_subscribers.py -# unit/test_tasks.py -# unit/test_upload.py -# unit/test_utils.py \ No newline at end of file diff --git a/recipes-devtools/python/python3-s3transfer_0.14.0.bb b/recipes-devtools/python/python3-s3transfer_0.14.0.bb index b12f169cac..ad2e9ec1a6 100644 --- a/recipes-devtools/python/python3-s3transfer_0.14.0.bb +++ b/recipes-devtools/python/python3-s3transfer_0.14.0.bb @@ -4,9 +4,12 @@ HOMEPAGE = "https://github.com/boto/s3transfer" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" +FILESEXTRAPATHS:prepend := "${THISDIR}/../files:" + SRC_URI = "\ git://github.com/boto/s3transfer.git;protocol=https;branch=master \ file://run-ptest \ + file://python_dependency_test.py \ " SRCREV = "b4ee0a2cc675088f8419e4996a9c560e510afd37" @@ -24,10 +27,11 @@ RDEPENDS:${PN} += "\ RDEPENDS:${PN}-ptest += "\ python3 \ python3-pytest \ - python3-urllib3 \ + python3-boto3 \ " do_install_ptest() { install -d ${D}${PTEST_PATH}/tests cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/ + install -m 0755 ${UNPACKDIR}/python_dependency_test.py ${D}${PTEST_PATH}/ }