Skip to content

Commit

Permalink
fix: skip url defined dependencies
Browse files Browse the repository at this point in the history
requirements-parser can't parse url based dependencies and exception was raised when replace was called on such deps
  • Loading branch information
Mila Votradovec authored and miiila committed May 22, 2019
1 parent fab75b0 commit 27be128
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plug/pip_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def get_requirements_list(requirements_file_path, dev_deps=False):
req_list = filter(matches_environment, req_list)
req_list = filter(is_testable, req_list)
req_list = filter(matches_python_version, req_list)
required = [req.name.replace('_', '-') for req in req_list]
required = [req.name.replace('_', '-') for req in req_list if req.name]
return required

def create_dependencies_tree_by_req_file_path(requirements_file_path,
Expand Down
18 changes: 18 additions & 0 deletions test/inspect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,24 @@ test('inspect pipenv app dev dependencies', function (t) {
});
});

test('package names with urls are skipped', function (t) {
return Promise.resolve().then(function () {
chdirWorkspaces('pip-app-deps-with-urls');
var venvCreated = testUtils.ensureVirtualenv('pip-app-deps-with-urls');
t.teardown(testUtils.activateVirtualenv('pip-app-deps-with-urls'));
if (venvCreated) {
testUtils.pipInstall();
}
})
.then(function () {
return plugin.inspect('.', 'requirements.txt');
})
.then(function (result) {
var pkg = result.package;
t.equal(Object.keys(pkg.dependencies).length, 1, '1 dependency was skipped');
});
});

function chdirWorkspaces(dir) {
process.chdir(path.resolve(__dirname, 'workspaces', dir));
}
2 changes: 2 additions & 0 deletions test/workspaces/pip-app-deps-with-urls/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Jinja2==2.7.2
https://files.pythonhosted.org/packages/d0/d7/4806fd165c27716f02a3a9c23d207854b8a3ed884db53c2781b92bd8d4f4/whl.setup-0.2-py2.py3-none-any.whl

0 comments on commit 27be128

Please sign in to comment.