Skip to content

Commit

Permalink
fixup linters and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
secustor committed May 17, 2023
1 parent ecc2f9c commit 84f6b36
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
22 changes: 19 additions & 3 deletions lib/modules/manager/pep621/artifacts.spec.ts
Expand Up @@ -22,7 +22,11 @@ const adminConfig: RepoGlobalConfig = {
describe('modules/manager/pep621/artifacts', () => {
describe('updateArtifacts()', () => {
it('return null if all processors returns are empty', async () => {
const updatedDeps = [{ depName: 'dep1' }];
const updatedDeps = [
{
packageName: 'dep1',
},
];
const result = await updateArtifacts({
packageFileName: 'pyproject.toml',
newPackageFileContent: '',
Expand All @@ -43,7 +47,7 @@ describe('modules/manager/pep621/artifacts', () => {
releases: [{ version: 'v2.6.1' }, { version: 'v2.5.0' }],
});

const updatedDeps = [{ depName: 'dep1' }];
const updatedDeps = [{ packageName: 'dep1' }];
const result = await updateArtifacts({
packageFileName: 'pyproject.toml',
newPackageFileContent: '',
Expand Down Expand Up @@ -73,7 +77,19 @@ describe('modules/manager/pep621/artifacts', () => {
},
},
{
cmd: 'docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool pdm v2.5.0 && pdm update dep1"',
cmd:
'docker run --rm --name=renovate_sidecar --label=renovate_child ' +
'-v "/tmp/github/some/repo":"/tmp/github/some/repo" ' +
'-v "/tmp/cache":"/tmp/cache" ' +
'-e BUILDPACK_CACHE_DIR ' +
'-e CONTAINERBASE_CACHE_DIR ' +
'-w "/tmp/github/some/repo" ' +
'containerbase/sidecar ' +
'bash -l -c "' +
'install-tool pdm v2.5.0 ' +
'&& ' +
'pdm update dep1' +
'"',
options: {
cwd: '/tmp/github/some/repo',
encoding: 'utf-8',
Expand Down
24 changes: 18 additions & 6 deletions lib/modules/manager/pep621/processors/pdm.spec.ts
Expand Up @@ -25,7 +25,7 @@ describe('modules/manager/pep621/processors/pdm', () => {
describe('updateArtifacts()', () => {
it('return null if there is no lock file', async () => {
fs.getSiblingFileName.mockReturnValueOnce('pdm.lock');
const updatedDeps = [{ depName: 'dep1' }];
const updatedDeps = [{ packageName: 'dep1' }];
const result = await processor.updateArtifacts({
packageFileName: 'pyproject.toml',
newPackageFileContent: '',
Expand All @@ -46,7 +46,7 @@ describe('modules/manager/pep621/processors/pdm', () => {
releases: [{ version: 'v2.6.1' }, { version: 'v2.5.0' }],
});

const updatedDeps = [{ depName: 'dep1' }];
const updatedDeps = [{ packageName: 'dep1' }];
const result = await processor.updateArtifacts({
packageFileName: 'pyproject.toml',
newPackageFileContent: '',
Expand All @@ -62,7 +62,19 @@ describe('modules/manager/pep621/processors/pdm', () => {
cmd: 'docker ps --filter name=renovate_sidecar -aq',
},
{
cmd: 'docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool pdm v2.5.0 && pdm update dep1"',
cmd:
'docker run --rm --name=renovate_sidecar --label=renovate_child ' +
'-v "/tmp/github/some/repo":"/tmp/github/some/repo" ' +
'-v "/tmp/cache":"/tmp/cache" ' +
'-e BUILDPACK_CACHE_DIR ' +
'-e CONTAINERBASE_CACHE_DIR ' +
'-w "/tmp/github/some/repo" ' +
'containerbase/sidecar ' +
'bash -l -c "' +
'install-tool pdm v2.5.0 ' +
'&& ' +
'pdm update dep1' +
'"',
},
]);
});
Expand All @@ -75,7 +87,7 @@ describe('modules/manager/pep621/processors/pdm', () => {
throw new Error('test error');
});

const updatedDeps = [{ depName: 'dep1' }];
const updatedDeps = [{ packageName: 'dep1' }];
const result = await processor.updateArtifacts({
packageFileName: 'pyproject.toml',
newPackageFileContent: '',
Expand All @@ -99,7 +111,7 @@ describe('modules/manager/pep621/processors/pdm', () => {
releases: [{ version: 'v2.6.1' }, { version: 'v2.5.0' }],
});

const updatedDeps = [{ depName: 'dep1' }, { depName: 'dep2' }];
const updatedDeps = [{ packageName: 'dep1' }, { packageName: 'dep2' }];
const result = await processor.updateArtifacts({
packageFileName: 'pyproject.toml',
newPackageFileContent: '',
Expand Down Expand Up @@ -152,7 +164,7 @@ describe('modules/manager/pep621/processors/pdm', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'pdm update ',
cmd: 'pdm update',
},
]);
});
Expand Down
5 changes: 2 additions & 3 deletions lib/modules/manager/pep621/processors/pdm.ts
Expand Up @@ -79,9 +79,8 @@ export class PdmProcessor implements PyProjectProcessor {
// else only update specific packages
let packageList = '';
if (!isLockFileMaintenance) {
packageList = ' ' + updatedDeps
.map((value) => value.packageName)
.join(' ');
packageList = ' ';
packageList += updatedDeps.map((value) => value.packageName).join(' ');
}
const cmd = `pdm update${packageList}`;
await exec(cmd, execOptions);
Expand Down

0 comments on commit 84f6b36

Please sign in to comment.