diff --git a/__tests__/cache-restore.test.ts b/__tests__/cache-restore.test.ts index d84c2296..d622607e 100644 --- a/__tests__/cache-restore.test.ts +++ b/__tests__/cache-restore.test.ts @@ -184,19 +184,31 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py ); } - if (process.platform === 'linux' && packageManager === 'pip') { - expect(infoSpy).toHaveBeenCalledWith( - `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-20.04-Ubuntu-python-${pythonVersion}-${packageManager}-${fileHash}` - ); - } else if (packageManager === 'poetry') { - expect(infoSpy).toHaveBeenCalledWith( - `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-v2-${fileHash}` - ); - } else { - expect(infoSpy).toHaveBeenCalledWith( - `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-${fileHash}` - ); - } + const restoredKeys = restoreCacheSpy.mock.results.map( + result => result.value + ); + + restoredKeys.forEach(restoredKey => { + if (restoredKey) { + if (process.platform === 'linux' && packageManager === 'pip') { + expect(infoSpy).toHaveBeenCalledWith( + `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-20.04-Ubuntu-python-${pythonVersion}-${packageManager}-${fileHash}` + ); + } else if (packageManager === 'poetry') { + expect(infoSpy).toHaveBeenCalledWith( + `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-v2-${fileHash}` + ); + } else { + expect(infoSpy).toHaveBeenCalledWith( + `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-${fileHash}` + ); + } + } else { + expect(infoSpy).toHaveBeenCalledWith( + `${packageManager} cache is not found` + ); + } + }); }, 30000 ); diff --git a/__tests__/data/pyproject.toml b/__tests__/data/pyproject.toml index a1d60064..ea11cea4 100644 --- a/__tests__/data/pyproject.toml +++ b/__tests__/data/pyproject.toml @@ -7,7 +7,8 @@ authors = ["Your Name "] [tool.poetry.dependencies] python = ">=3.8,<3.13" flake8 = "^4.0.1" -pyinstaller = "5.13.1" +pyinstaller = "5.13.1" + [tool.poetry.dev-dependencies] diff --git a/__tests__/data/requirements.txt b/__tests__/data/requirements.txt index fa40ab3c..62b581b2 100644 --- a/__tests__/data/requirements.txt +++ b/__tests__/data/requirements.txt @@ -34,7 +34,7 @@ pillow==7.2 pygments==2.6.1 -pyinstaller==3.6 +pyinstaller==5.13.1 pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'