[stable/2024.1] Transition to Tox (#1631)

This is an automated cherry-pick of #1617
/assign mnaser
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 0df61f0..7aaa2dd 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -4,6 +4,10 @@
     pre-run: zuul.d/playbooks/linters/pre.yml
 
 - job:
+    name: atmosphere-tox-py3
+    parent: tox
+
+- job:
     name: atmosphere-build-collection
     parent: build-ansible-collection
     pre-run: zuul.d/playbooks/build-collection/pre.yml
diff --git a/zuul.d/playbooks/upgrade/run-upgrade.yml b/zuul.d/playbooks/upgrade/run-upgrade.yml
index 79d0c4b..cb7e485 100644
--- a/zuul.d/playbooks/upgrade/run-upgrade.yml
+++ b/zuul.d/playbooks/upgrade/run-upgrade.yml
@@ -25,17 +25,16 @@
       args:
         chdir: "{{ zuul.project.src_dir }}"
 
-    - name: Run molecule with exist branch
+    - name: Run molecule with existing branch
       become: true
-      ansible.builtin.shell: |
-        pip install --ignore-installed poetry
-        poetry install
-        pip install -r test-requirements.txt
-        poetry run molecule converge -s aio
-      args:
-        chdir: "{{ zuul.project.src_dir }}"
-      environment:
-        ATMOSPHERE_NETWORK_BACKEND: "{{ network_backend }}"
+      ansible.builtin.include_role:
+        name: tox
+      vars:
+        tox_envlist: molecule-venv
+        tox_extra_args: "-- converge -s aio"
+        tox_environment:
+          ATMOSPHERE_NETWORK_BACKEND: "{{ network_backend }}"
+        zuul_work_dir: "{{ zuul.project.src_dir }}"
 
     - name: Checkout to "{{ zuul.branch }}" branch
       become: true
@@ -46,14 +45,24 @@
       args:
         chdir: "{{ zuul.project.src_dir }}"
 
-    - name: Run molecule to upgrade
+    - name: Upgrade cloud to "{{ zuul.branch }}"
       become: true
-      ansible.builtin.shell: |
-        poetry install
-        pip install -r test-requirements.txt
-        poetry run molecule converge -s aio
-        poetry run molecule verify -s aio
-      args:
-        chdir: "{{ zuul.project.src_dir }}"
-      environment:
-        ATMOSPHERE_NETWORK_BACKEND: "{{ network_backend }}"
+      ansible.builtin.include_role:
+        name: tox
+      vars:
+        tox_envlist: molecule-venv
+        tox_extra_args: "-- converge -s aio"
+        tox_environment:
+          ATMOSPHERE_NETWORK_BACKEND: "{{ network_backend }}"
+        zuul_work_dir: "{{ zuul.project.src_dir }}"
+
+    - name: Verify if upgrade was successful
+      become: true
+      ansible.builtin.include_role:
+        name: tox
+      vars:
+        tox_envlist: molecule-venv
+        tox_extra_args: "-- verify -s aio"
+        tox_environment:
+          ATMOSPHERE_NETWORK_BACKEND: "{{ network_backend }}"
+        zuul_work_dir: "{{ zuul.project.src_dir }}"
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index 2b45a64..d7c6238 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -17,6 +17,7 @@
     check:
       jobs:
         - atmosphere-linters
+        - atmosphere-tox-py3
         - atmosphere-build-collection:
             dependencies: &molecule_check_dependencies
               - name: atmosphere-build-container-image-barbican
@@ -84,6 +85,7 @@
     gate:
       jobs:
         - atmosphere-linters
+        - atmosphere-tox-py3
         - atmosphere-build-collection:
             dependencies: &molecule_gate_dependencies
               - name: atmosphere-upload-container-image-barbican