1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-16 00:41:30 +00:00

simplify the test

This commit is contained in:
Alexei Znamensky 2026-03-22 16:10:23 +13:00
parent aa3ce19135
commit 011426701f
3 changed files with 2 additions and 54 deletions

View file

@ -24,38 +24,15 @@
state: present
virtualenv: "{{ tmp_python_runner.path }}/venv"
- name: Copy settings file to temporary directory
ansible.builtin.copy:
src: settings.py
dest: "{{ tmp_python_runner.path }}/settings.py"
mode: "0644"
# Regression test for https://github.com/ansible-collections/community.general/issues/8884
# Bug: PythonRunner was setting path_prefix to a string instead of a list, corrupting PATH
# when venv was specified, so the venv's python could not be found.
- name: Run django_command check using virtualenv (regression test for issue 8884)
community.general.django_command:
command: check
settings: settings
pythonpath: "{{ tmp_python_runner.path }}"
venv: "{{ tmp_python_runner.path }}/venv"
register: result_check
- name: Assert django_command succeeded and returned a version
ansible.builtin.assert:
that:
- result_check is success
- result_check.version is defined
- result_check.version != ""
# Second test: mirrors the scenario from issue 8884 — a real Django project created
# with django-admin startproject, then checked via django_command with a venv.
# The original reporter was running `migrate`; we use `check` to avoid needing a database.
- name: Create Django project using venv django-admin
ansible.builtin.command:
cmd: >-
{{ tmp_python_runner.path }}/venv/bin/django-admin startproject
testproject {{ tmp_python_runner.path }}/testproject
{{ tmp_python_runner.path }}/venv/bin/django-admin startproject testproject
chdir: {{ tmp_python_runner.path }}
- name: Run django_command check on the created project (issue 8884 scenario)
community.general.django_command: