8000 tests/cache-restore: Do not look for dependency files outside `data` · actions/setup-python@3d21900 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d21900

Browse files
committed
tests/cache-restore: Do not look for dependency files outside data
When the default dependency path is used for cache distributors, they are looking for the dependency file in the project's root (including the source code), which leads to tests taking a significant amount of time, especially on Windows runners. We thus hit sporadic test failures. Change the test cases such that dependency files are always searched for inside of `__tests__/data`, ignoring the rest of the project.
1 parent 9f8e66a commit 3d21900

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

__tests__/cache-restore.test.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,17 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
101101

102102
describe('Restore dependencies', () => {
103103
it.each([
104-
['pip', '3.8.12', undefined, requirementsHash, undefined],
105104
[
106105
'pip',
107106
'3.8.12',
108-
'**/requirements-linux.txt',
107+
'__tests__/data/**/requirements.txt',
108+
requirementsHash,
109+
undefined
110+
],
111+
[
112+
'pip',
113+
'3.8.12',
114+
'__tests__/data/**/requirements-linux.txt',
109115
requirementsLinuxHash,
110116
undefined
111117
],
@@ -123,7 +129,13 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
123129
requirementsHash,
124130
undefined
125131
],
126-
['pipenv', '3.9.1', undefined, pipFileLockHash, undefined],
132+
[
133+
'pipenv',
134+
'3.9.1',
135+
'__tests__/data/**/Pipfile.lock',
136+
pipFileLockHash,
137+
undefined
138+
],
127139
[
128140
'pipenv',
129141
'3.9.12',
@@ -134,7 +146,7 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
134146
[
135147
'poetry',
136148
'3.9.1',
137-
undefined,
149+
'__tests__/data/**/poetry.lock',
138150
poetryLockHash,
139151
[
140152
'/Users/patrick/Library/Caches/pypoetry/virtualenvs',
@@ -213,18 +225,23 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
213225

214226
describe('Dependencies changed', () => {
215227
it.each([
216-
['pip', '3.8.12', undefined, pipFileLockHash],
217-
['pip', '3.8.12', '**/requirements-linux.txt', pipFileLockHash],
228+
['pip', '3.8.12', '__tests__/data/**/requirements.txt', pipFileLockHash],
229+
[
230+
'pip',
231+
'3.8.12',
232+
'__tests__/data/**/requirements-linux.txt',
233+
pipFileLockHash
234+
],
218235
[
219236
'pip',
220237
'3.8.12',
221238
'__tests__/data/requirements-linux.txt',
222239
pipFileLockHash
223240
],
224241
['pip', '3.8.12', '__tests__/data/requirements.txt', pipFileLockHash],
225-
['pipenv', '3.9.1', undefined, requirementsHash],
242+
['pipenv', '3.9.1', '__tests__/data/**/Pipfile.lock', requirementsHash],
226243
['pipenv', '3.9.12', '__tests__/data/requirements.txt', requirementsHash],
227-
['poetry', '3.9.1', undefined, requirementsHash]
244+
['poetry', '3.9.1', '__tests__/data/**/poetry.lock', requirementsHash]
228245
])(
229246
'restored dependencies for %s by primaryKey',
230247
async (packageManager, pythonVersion, dependencyFile, fileHash) => {

0 commit comments

Comments
 (0)
0