Skip to content

Commit

Permalink
test: test to assert a dep not maching any Python envs is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 committed May 2, 2019
1 parent 8bc57a9 commit c8af965
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/node_modules/
__pycache__/
*.pyc
npm-debug.log
test/.venvs/
27 changes: 25 additions & 2 deletions test/inspect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ test('transitive dep not installed, but with allowMissing option',
t.ok(pkg, 'package');
t.equal(pkg.name, 'pip-app', 'name');
t.equal(pkg.version, '0.0.0', 'version');
// t.equal(pkg.full, 'pip-app@0.0.0', 'full'); // do we need this?
t.end();
});

Expand Down Expand Up @@ -321,7 +320,7 @@ test('uses provided exec command', function (t) {
});
});

test('package name differs from requirement', function (t) {
test('package name differs from requirement (- vs _)', function (t) {
return Promise.resolve().then(function () {
chdirWorkspaces('pip-app-deps-with-dashes');
var venvCreated = testUtils.ensureVirtualenv('pip-app-deps-with-dashes');
Expand All @@ -347,6 +346,30 @@ test('package name differs from requirement', function (t) {
});
});

test('package name differs from requirement (- vs .)', function (t) {
t.pass('Not implemented yet');
t.end();
});

test('package installed conditionally based on python version', function (t) {
return Promise.resolve().then(function () {
chdirWorkspaces('pip-app-with-python-markers');
var venvCreated = testUtils.ensureVirtualenv('pip-app-with-python-markers');
t.teardown(testUtils.activateVirtualenv('pip-app-with-python-markers'));
if (venvCreated) {
testUtils.pipInstall();
}
})
.then(function () {
return plugin.inspect('.', 'requirements.txt');
})
.then(function (result) {
var pkg = result.package;
t.notOk(pkg.dependencies.enum34, 'enum34 dep ignored');
t.end();
});
});

test('package depends on platform', function (t) {
return Promise.resolve().then(function () {
chdirWorkspaces('pip-app-deps-conditional');
Expand Down
25 changes: 25 additions & 0 deletions test/workspaces/pip-app-with-python-markers/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
amqp==2.4.2
apscheduler==3.6.0
asn1crypto==0.24.0
astroid==1.6.6
atomicwrites==1.3.0
attrs==19.1.0
automat==0.7.0
backports.functools-lru-cache==1.5 ; python_version < '3.2'
billiard==3.6.0.0
celery==4.3.0
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
click==7.0
clickclick==1.2.2
configparser==3.7.4 ; python_version == '2.7'
connexion[swagger-ui]==2.2.0
constantly==15.1.0
cryptography==2.6.1
cssselect==1.0.3
cython==0.29.7
enum34==1.1.6 ; python_version < '2.6'
fastavro==0.21.21
flask-apscheduler==1.11.0
flask==1.0.2

0 comments on commit c8af965

Please sign in to comment.