From 1651e5bef0cebbda4a2b21b6f71cc3f321c353af Mon Sep 17 00:00:00 2001 From: eeintech Date: Fri, 12 Jul 2024 17:59:45 -0400 Subject: [PATCH] Add Jameco and AutomationDirect tests, revert back to InvenTree stable, update InvenTree python API --- .github/workflows/test_deploy.yaml | 2 +- kintree/common/tools.py | 2 +- poetry.lock | 8 ++++---- pyproject.toml | 2 +- run_tests.py | 32 +++++++++++++++++++++++++++--- 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_deploy.yaml b/.github/workflows/test_deploy.yaml index f80b1667..8f4de210 100644 --- a/.github/workflows/test_deploy.yaml +++ b/.github/workflows/test_deploy.yaml @@ -75,7 +75,7 @@ jobs: git clone https://github.com/inventree/InvenTree/ mkdir InvenTree/static cp tests/files/inventree_default_db.sqlite3 InvenTree/ - cd InvenTree/ && git switch master && invoke install && invoke migrate && cd - + cd InvenTree/ && git switch stable && invoke install && invoke migrate && cd - - name: Ki-nTree setup run: | invoke install diff --git a/kintree/common/tools.py b/kintree/common/tools.py index d28416de..13276f4e 100644 --- a/kintree/common/tools.py +++ b/kintree/common/tools.py @@ -184,5 +184,5 @@ def download_with_retry(url: str, full_path: str, silent=False, **kwargs) -> str if not file: return False - cprint('[INFO]\tSuccess: Part image downloaded', silent=silent) + cprint(f'[INFO]\tDownload success ({url=})', silent=silent) return True diff --git a/poetry.lock b/poetry.lock index 2fb1a118..80b2b3c2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -830,13 +830,13 @@ files = [ [[package]] name = "inventree" -version = "0.13.5" +version = "0.14.0" description = "Python interface for InvenTree inventory management system" optional = false python-versions = ">=3.8" files = [ - {file = "inventree-0.13.5-py2.py3-none-any.whl", hash = "sha256:cccad460e5d44d338f633e5b41ef3cee2a91529871087556afef0ae7e626f064"}, - {file = "inventree-0.13.5.tar.gz", hash = "sha256:533fa40ee60ec89fde62875b14447d4b05499046d6bcf3ece41ed5f2bb96d1e4"}, + {file = "inventree-0.14.0-py2.py3-none-any.whl", hash = "sha256:7d10a6437970d8d07a417f12fb61b95fbc69bea4678d03477f136a8f4d0537e9"}, + {file = "inventree-0.14.0.tar.gz", hash = "sha256:b85662f263577a4dcc6c51176b3c2bbb36bb53c688c52bd2b8226f8370a21e9a"}, ] [package.dependencies] @@ -2213,4 +2213,4 @@ test = ["black", "codecov", "coloredlogs", "coverage", "flake8", "mypy", "pytest [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "e890a592fdcf5a9b1a9b2bfedc04371caf5eff930481d6c3f60a9e1d898402b9" +content-hash = "d837be7d7a4b3578dea1755a7ee43befa2455aa490a84120ab06369ce5b64945" diff --git a/pyproject.toml b/pyproject.toml index 676261d2..2b2404cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ digikey-api = "^1.0.0" # digikey-api = { git = "https://github.com/hurricaneJoef/digikey-api.git", branch = "master" } flet = "^0.23.0" thefuzz = "^0.19.0" -inventree = "^0.13.3" +inventree = "^0.14.0" kiutils = "^1.4.0" mouser = "^0.1.3" multiprocess = "^0.70.12" diff --git a/run_tests.py b/run_tests.py index 45703d9e..adc070b7 100644 --- a/run_tests.py +++ b/run_tests.py @@ -6,8 +6,16 @@ from kintree.config import config_interface from kintree.database import inventree_api, inventree_interface from kintree.kicad import kicad_interface -from kintree.search import digikey_api, mouser_api, element14_api, lcsc_api, tme_api -from kintree.search.snapeda_api import test_snapeda_api +from kintree.search import ( + digikey_api, + mouser_api, + element14_api, + lcsc_api, + tme_api, + snapeda_api, + automationdirect_api, + jameco_api, +) from kintree.setup_inventree import setup_inventree @@ -129,9 +137,27 @@ def check_result(status: str, new_part: bool) -> bool: else: cprint('[ PASS ]') + # Test AutomationDirect API + if 'AutomationDirect' in settings.SUPPORTED_SUPPLIERS_API: + pretty_test_print('[MAIN]\tAutomationDirect API Test') + if not automationdirect_api.test_api(): + cprint('[ FAIL ]') + sys.exit(-1) + else: + cprint('[ PASS ]') + + # Test Jameco API + if 'Jameco' in settings.SUPPORTED_SUPPLIERS_API: + pretty_test_print('[MAIN]\tJameco API Test') + if not jameco_api.test_api(): + cprint('[ FAIL ]') + sys.exit(-1) + else: + cprint('[ PASS ]') + # Test SnapEDA API methods pretty_test_print('[MAIN]\tSnapEDA API Test') - if not test_snapeda_api(): + if not snapeda_api.test_snapeda_api(): cprint('[ FAIL ]') sys.exit(-1) else: