Skip to content

Commit

Permalink
Update GHA python tests (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva authored Nov 7, 2023
1 parent 065c8b1 commit 8aab3ee
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
'PyYAML',
'fire==0.1.3',

'regex==2017.4.5',
'matplotlib>=2.2.0,<2.4.0',
'newrelic==2.0.*',
'jupyter~=1.1.1',
Expand Down
1 change: 0 additions & 1 deletion src/test/resources/python/regex/setupWithNoName.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
'PyYAML',
'fire==0.1.3',

'regex==2017.4.5',
'matplotlib>=2.2.0,<2.4.0',
'newrelic==2.0.*',
'jupyter~=1.1.1',
Expand Down
1 change: 0 additions & 1 deletion src/test/resources/python/requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
fire==0.1.3
regex==2017.4.5
newrelic==2.0.0.1
2 changes: 1 addition & 1 deletion src/test/resources/python/setup/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
setuptools.setup(
name="snake",
version="2.2.2",
install_requires=['fire==0.1.3', 'regex==2017.4.5', 'newrelic==2.0.0.1']
install_requires=['fire==0.1.3', 'newrelic==2.0.0.1']
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
fire==0.1.3
regex==2017.4.5
newrelic==2.0.0.1
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
fire==0.1.3
regex==2017.4.5
newrelic==2.0.0.1
13 changes: 6 additions & 7 deletions src/test/tests/pypiUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ describe('Pypi Utils Tests', async () => {
dependencyToVersion = PypiUtils.getSetupPyDirectDependencies(path.join(tmpDir.fsPath, 'regex', 'setupAllKindOfDepsVariations.py'));
assert.equal(dependencyToVersion.get('pyyaml'), '');
assert.equal(dependencyToVersion.get('fire'), '==0.1.3');
assert.equal(dependencyToVersion.get('regex'), '==2017.4.5');
assert.equal(dependencyToVersion.get('matplotlib'), '>=2.2.0,<2.4.0');
assert.equal(dependencyToVersion.get('newrelic'), '==2.0.*');
assert.equal(dependencyToVersion.get('jupyter'), '~=1.1.1');
assert.equal(dependencyToVersion.get('numpy'), '>=1.14.5');
assert.equal(dependencyToVersion.size, 7);
assert.equal(dependencyToVersion.size, 6);
});

it('Match setup.py project name with regex', () => {
Expand Down Expand Up @@ -145,13 +144,13 @@ describe('Pypi Utils Tests', async () => {
new GeneralInfo('newrelic', '2.0.0.1', [], '', PackageType.Unknown)
);
let dependencyPos: vscode.Range[] = PypiUtils.getDependencyPosition(textDocument, dependenciesTreeNode.generalInfo.artifactId);
assert.deepEqual(dependencyPos[0].start, new vscode.Position(2, 0));
assert.deepEqual(dependencyPos[0].start, new vscode.Position(1, 0));

// Test 'resources/python/setupAndRequirements'
requirements = vscode.Uri.file(path.join(tmpDir.fsPath, 'setupAndRequirements', 'requirements.txt'));
textDocument = await vscode.workspace.openTextDocument(requirements);
dependencyPos = PypiUtils.getDependencyPosition(textDocument, dependenciesTreeNode.generalInfo.artifactId);
assert.deepEqual(dependencyPos[0].start, new vscode.Position(2, 0));
assert.deepEqual(dependencyPos[0].start, new vscode.Position(1, 0));
});

/**
Expand Down Expand Up @@ -180,7 +179,7 @@ describe('Pypi Utils Tests', async () => {
// Test 'resources/python/requirements'
let node: PypiTreeNode | undefined = parent.children[0] as PypiTreeNode;
assert.deepEqual(node?.label, 'requirements.txt');
assert.deepEqual(node?.children.length, 3);
assert.deepEqual(node?.children.length, 2);
checkFireDependency(node);

// Test 'resources/python/setup'
Expand All @@ -199,7 +198,7 @@ describe('Pypi Utils Tests', async () => {
);
node = parent.children[1] as PypiTreeNode;
assert.deepEqual(node.label, 'setup.py');
assert.deepEqual(node.children.length, 3);
assert.deepEqual(node.children.length, 2);
checkFireDependency(node);

// Test 'resources/python/setupAndRequirements'
Expand Down Expand Up @@ -229,7 +228,7 @@ describe('Pypi Utils Tests', async () => {
assert.fail;
return;
}
assert.deepEqual(node.children.length, 3);
assert.deepEqual(node.children.length, 2);
checkFireDependency(node);
});

Expand Down

0 comments on commit 8aab3ee

Please sign in to comment.