Skip to content

Commit 28ee609

Browse files
committed
Use requests package instead of pytest for testing pip module
requests has less dependencies
1 parent c86e935 commit 28ee609

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

images/debian_bullseye/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ RUN echo "*nat\n:PREROUTING ACCEPT [0:0]\n:INPUT ACCEPT [0:0]\n:OUTPUT ACCEPT [0
6767
RUN chage -E 20000 user
6868

6969
# Some python3 virtualenv
70-
RUN virtualenv /v && /v/bin/pip install 'pytest>5,<6'
70+
RUN virtualenv /v && /v/bin/pip install 'requests>1,<2'
7171

7272
ENV LANG fr_FR.ISO-8859-15
7373
ENV LANGUAGE fr_FR

test/test_modules.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -553,37 +553,37 @@ def test_command_execution(host):
553553
def test_pip_package(host):
554554
with pytest.warns(DeprecationWarning):
555555
assert host.pip_package.get_packages()["pip"]["version"] == "20.3.4"
556-
pytest_package = host.pip_package.get_packages(pip_path="/v/bin/pip")["pytest"]
557-
assert pytest_package["version"].startswith("5.")
556+
pkg = host.pip_package.get_packages(pip_path="/v/bin/pip")["requests"]
557+
assert pkg["version"].startswith("1.")
558558
with pytest.warns(DeprecationWarning):
559559
outdated = host.pip_package.get_outdated_packages(pip_path="/v/bin/pip")[
560-
"pytest"
560+
"requests"
561561
]
562-
assert outdated["current"] == pytest_package["version"]
563-
assert int(outdated["latest"].split(".")[0]) > 2
562+
assert outdated["current"] == pkg["version"]
563+
assert int(outdated["latest"].split(".")[0]) >= 1
564564
with pytest.warns(DeprecationWarning):
565565
assert host.pip_package.check().succeeded
566566

567567

568568
def test_pip(host):
569569
# get_packages
570570
assert host.pip.get_packages()["pip"]["version"] == "20.3.4"
571-
pytest_package = host.pip.get_packages(pip_path="/v/bin/pip")["pytest"]
572-
assert pytest_package["version"].startswith("5.")
571+
pkg = host.pip.get_packages(pip_path="/v/bin/pip")["requests"]
572+
assert pkg["version"].startswith("1.")
573573
# outdated
574-
outdated = host.pip.get_outdated_packages(pip_path="/v/bin/pip")["pytest"]
575-
assert outdated["current"] == pytest_package["version"]
576-
assert int(outdated["latest"].split(".")[0]) >= 6
574+
outdated = host.pip.get_outdated_packages(pip_path="/v/bin/pip")["requests"]
575+
assert outdated["current"] == pkg["version"]
576+
assert int(outdated["latest"].split(".")[0]) >= 1
577577
# check
578578
assert host.pip.check().succeeded
579579
# is_installed
580580
assert host.pip("pip").is_installed
581581
assert not host.pip("does_not_exist").is_installed
582-
pytest_package = host.pip("pytest", pip_path="/v/bin/pip")
583-
assert pytest_package.is_installed
582+
pkg = host.pip("requests", pip_path="/v/bin/pip")
583+
assert pkg.is_installed
584584
# version
585585
assert host.pip("pip").version == "20.3.4"
586-
assert pytest_package.version.startswith("5.")
586+
assert pkg.version.startswith("1.")
587587
assert host.pip("does_not_exist").version == ""
588588

589589

0 commit comments

Comments
 (0)