mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 15:32:13 +00:00
Fix tests and rebuild
This commit is contained in:
parent
56d358493b
commit
168d1eac87
3 changed files with 12 additions and 11 deletions
|
@ -193,12 +193,12 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
||||||
|
|
||||||
describe('Check if handleMatchResult', () => {
|
describe('Check if handleMatchResult', () => {
|
||||||
it.each([
|
it.each([
|
||||||
['pip', '3.8.12', 'requirements.txt', 'someKey', true],
|
['pip', '3.8.12', 'requirements.txt', 'someKey', 'someKey', true],
|
||||||
['pipenv', '3.9.1', 'requirements.txt', 'someKey', true],
|
['pipenv', '3.9.1', 'requirements.txt', 'someKey', 'someKey', true],
|
||||||
['poetry', '3.8.12', 'requirements.txt', 'someKey', true],
|
['poetry', '3.8.12', 'requirements.txt', 'someKey', 'someKey', true],
|
||||||
['pip', '3.9.2', 'requirements.txt', undefined, false],
|
['pip', '3.9.2', 'requirements.txt', undefined, 'someKey', false],
|
||||||
['pipenv', '3.8.12', 'requirements.txt', undefined, false],
|
['pipenv', '3.8.12', 'requirements.txt', undefined, 'someKey', false],
|
||||||
['poetry', '3.9.12', 'requirements.txt', undefined, false]
|
['poetry', '3.9.12', 'requirements.txt', undefined, 'someKey', false]
|
||||||
])(
|
])(
|
||||||
'sets correct outputs',
|
'sets correct outputs',
|
||||||
async (
|
async (
|
||||||
|
@ -206,6 +206,7 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
||||||
pythonVersion,
|
pythonVersion,
|
||||||
dependencyFile,
|
dependencyFile,
|
||||||
matchedKey,
|
matchedKey,
|
||||||
|
restoredKey,
|
||||||
expectedOutputValue
|
expectedOutputValue
|
||||||
) => {
|
) => {
|
||||||
const cacheDistributor = getCacheDistributor(
|
const cacheDistributor = getCacheDistributor(
|
||||||
|
@ -213,7 +214,7 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
||||||
pythonVersion,
|
pythonVersion,
|
||||||
dependencyFile
|
dependencyFile
|
||||||
);
|
);
|
||||||
cacheDistributor.handleMatchResult(matchedKey);
|
cacheDistributor.handleMatchResult(matchedKey, restoredKey);
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith(
|
expect(setOutputSpy).toHaveBeenCalledWith(
|
||||||
'cache-hit',
|
'cache-hit',
|
||||||
expectedOutputValue
|
expectedOutputValue
|
||||||
|
|
4
dist/cache-save/index.js
vendored
4
dist/cache-save/index.js
vendored
|
@ -37238,14 +37238,14 @@ class CacheDistributor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
handleMatchResult(matchedKey, primaryKey) {
|
handleMatchResult(matchedKey, primaryKey) {
|
||||||
if (matchedKey == primaryKey) {
|
if (matchedKey) {
|
||||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||||
core.info(`Cache restored from key: ${matchedKey}`);
|
core.info(`Cache restored from key: ${matchedKey}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(`${this.packageManager} cache is not found`);
|
core.info(`${this.packageManager} cache is not found`);
|
||||||
}
|
}
|
||||||
core.setOutput('cache-hit', Boolean(matchedKey));
|
core.setOutput('cache-hit', matchedKey === primaryKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = CacheDistributor;
|
exports.default = CacheDistributor;
|
||||||
|
|
4
dist/setup/index.js
vendored
4
dist/setup/index.js
vendored
|
@ -42583,14 +42583,14 @@ class CacheDistributor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
handleMatchResult(matchedKey, primaryKey) {
|
handleMatchResult(matchedKey, primaryKey) {
|
||||||
if (matchedKey == primaryKey) {
|
if (matchedKey) {
|
||||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||||
core.info(`Cache restored from key: ${matchedKey}`);
|
core.info(`Cache restored from key: ${matchedKey}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(`${this.packageManager} cache is not found`);
|
core.info(`${this.packageManager} cache is not found`);
|
||||||
}
|
}
|
||||||
core.setOutput('cache-hit', Boolean(matchedKey));
|
core.setOutput('cache-hit', matchedKey === primaryKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = CacheDistributor;
|
exports.default = CacheDistributor;
|
||||||
|
|
Loading…
Add table
Reference in a new issue