zuul-jobs/test-playbooks/python/fetch-subunit-output.yaml
Ian Wienand 95d53aa40e setup.py: override modules to stop auto-detection
Some of our jobs have started failing with

   error: Multiple top-level packages discovered in a flat-layout:
   ['roles', 'playbooks'].
   ... <and so on> ...

which seems to be a combination of jobs that don't run often and some
recent-ish version of setuptools/pip.  From what I can tell, what we
want to do here is disable autodetection as what we have isn't really
a python distributable package.

Also fix the two places this is monkey-patched in over the existing
file.

Change-Id: I2a0dfbbedbb9bddd34b6af691118cf7c422a82b0
2022-07-27 11:14:06 +10:00

69 lines
1.8 KiB
YAML

- hosts: all
pre_tasks:
# Run ensure-output-dirs now as it is not performed speculatively
- import_role:
name: ensure-output-dirs
- name: Create fake test directory
file:
path: "{{ zuul.project.src_dir }}/ztest"
state: directory
- name: Simplify tox config
copy:
content: "{{ item.content }}"
dest: "{{ zuul.project.src_dir }}/{{ item.dest }}"
with_items:
- content: |
[testenv]
sitepackages = True
usedevelop = True
deps = stestr
[testenv:venv]
commands = stestr run --test-path ./ztest/ {posargs}
dest: tox.ini
- content: |
import setuptools
setuptools.setup(py_modules=[])
dest: setup.py
- content: ""
dest: setup.cfg
- content: |
import unittest
class TestTestCase(unittest.TestCase):
def test_test(self):
assert True
dest: ztest/__init__.py
- name: Generate tox results
include_role:
name: "{{ item }}"
with_items:
- ensure-tox
- ensure-python
- tox
tasks:
- import_role:
name: fetch-subunit-output
- import_role:
name: fetch-output
when: zuul_use_fetch_output
post_tasks:
- name: Check for artifact on the test instance
stat:
path: "{{ ansible_user_dir }}/zuul-output/logs/testr_results.html"
register: _test_artifact
failed_when: not _test_artifact.stat.exists
when: zuul_use_fetch_output
- name: Check for artifact on the executor
stat:
path: "{{ zuul.executor.log_root }}/testr_results.html"
delegate_to: localhost
register: _executor_artifact
failed_when: not _executor_artifact.stat.exists