← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~jugmac00/lpcraft:fix-tox-using-the-wrong-interpreter into lpcraft:main

 

Jürgen Gmach has proposed merging ~jugmac00/lpcraft:fix-tox-using-the-wrong-interpreter into lpcraft:main.

Commit message:
Fix tox plugin not selecting the right interpreter

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jugmac00/lpcraft/+git/lpcraft/+merge/413713
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/lpcraft:fix-tox-using-the-wrong-interpreter into lpcraft:main.
diff --git a/lpcraft/plugin/tests/test_plugins.py b/lpcraft/plugin/tests/test_plugins.py
index af5c0f3..ff263a7 100644
--- a/lpcraft/plugin/tests/test_plugins.py
+++ b/lpcraft/plugin/tests/test_plugins.py
@@ -68,14 +68,27 @@ class TestPlugins(CommandBaseTestCase):
         self.assertEqual(
             [
                 call(
-                    ["apt", "install", "-y", "tox", "nginx", "apache2"],
+                    [
+                        "apt",
+                        "install",
+                        "-y",
+                        "python3-pip",
+                        "nginx",
+                        "apache2",
+                    ],
                     cwd=PosixPath("/root/project"),
                     env={"PLUGIN": "tox"},
                     stdout=ANY,
                     stderr=ANY,
                 ),
                 call(
-                    ["bash", "--noprofile", "--norc", "-ec", "tox"],
+                    [
+                        "bash",
+                        "--noprofile",
+                        "--norc",
+                        "-ec",
+                        "python3 -m pip install tox==3.24.5;tox",
+                    ],
                     cwd=PosixPath("/root/project"),
                     env={"PLUGIN": "tox"},
                     stdout=ANY,
@@ -147,7 +160,14 @@ class TestPlugins(CommandBaseTestCase):
         self.assertEqual(
             [
                 call(
-                    ["apt", "install", "-y", "tox", "nginx", "apache2"],
+                    [
+                        "apt",
+                        "install",
+                        "-y",
+                        "python3-pip",
+                        "nginx",
+                        "apache2",
+                    ],
                     cwd=PosixPath("/root/project"),
                     env={"PLUGIN": "tox"},
                     stdout=ANY,
diff --git a/lpcraft/plugins/plugins.py b/lpcraft/plugins/plugins.py
index 032cf8e..36b57c6 100644
--- a/lpcraft/plugins/plugins.py
+++ b/lpcraft/plugins/plugins.py
@@ -19,17 +19,16 @@ class ToxPlugin:
         within the job definition.
     """
 
-    # XXX jugmac00 2021-12-16: this plugin is not yet fully implemented
     def __init__(self, config: Job) -> None:
         self.config = config
 
     @hookimpl  # type: ignore
     def lpcraft_install_packages(self) -> list[str]:
-        return ["tox"]
+        return ["python3-pip"]
 
     @hookimpl  # type: ignore
     def lpcraft_execute_run(self) -> str:
-        return "tox"
+        return "python3 -m pip install tox==3.24.5;tox"
 
     @hookimpl  # type: ignore
     def lpcraft_set_environment(self) -> dict[str, str | None]:
diff --git a/tox.ini b/tox.ini
index edf274c..318e847 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,6 +6,8 @@ envlist =
     py39
     py310
     coverage
+skip_missing_interpreters =
+    true
 
 [testenv]
 commands =