Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not redefine variable #8773

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion kolibri/utils/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ def get_debian_pkg_version(package):
if hasattr(output, "decode"): # needed in python 2.x
output = output.decode("utf-8")
package_info = output.split("\n")
version_info = [output for output in package_info if "Version" in output]
version_info = [line for line in package_info if "Version" in line]
if version_info:
version = version_info[0].split(":")[1].strip()
return version
Expand Down
19 changes: 19 additions & 0 deletions kolibri/utils/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,25 @@ def test_dpkg(self):
installation_types.DEB
].format("1.0")

@mock.patch("sys.argv", ["/usr/bin/kolibri", "start"])
def test_dpkg_version(self):
DPKG_OUTPUT = """
Package: kolibri
Status: install ok installed
Priority: optional
Section: education
Architecture: all
Source: kolibri-source
Version: 0.15.0~beta2-0ubuntu1
Depends: python3 (>= 3.4), python3-pkg-resources, adduser
Recommends: python3-cryptography (>= 1.2.3)
"""
with mock.patch("kolibri.utils.server.check_output", return_value=DPKG_OUTPUT):
install_type = server.installation_type()
assert install_type == installation_types.install_type_map[
installation_types.DEB
].format("0.15.0~beta2-0ubuntu1")

@mock.patch("sys.argv", ["/usr/bin/kolibri", "start"])
@mock.patch("os.environ", {"KOLIBRI_INSTALLER_VERSION": "1.0"})
def test_apt(apt):
Expand Down