# Python Django # Test a Django project on multiple versions of Python. # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/python trigger: - unstable - stable - 0.3 pr: - unstable - stable - 0.3 pool: vmImage: ubuntu-latest strategy: matrix: Python38Django22: PYTHON_VERSION: '3.8' DJANGO_VERSION: '22' Python39Django22: PYTHON_VERSION: '3.9' DJANGO_VERSION: '22' Python38Django32: PYTHON_VERSION: '3.8' DJANGO_VERSION: '32' Python39Django32: PYTHON_VERSION: '3.9' DJANGO_VERSION: '32' maxParallel: 10 steps: - task: UsePythonVersion@0 inputs: versionSpec: '$(PYTHON_VERSION)' architecture: 'x64' - task: PythonScript@0 displayName: 'Export quicktest.py path' inputs: scriptSource: 'inline' script: | """Search all subdirectories for `quicktest.py`.""" from glob import iglob from os import path # Python >= 3.5 quicktest_py = next(iglob(path.join('**', 'quicktest.py'), recursive=True), None) if not quicktest_py: raise SystemExit('Could not find quicktest.py for django-helpdesk') project_location = path.dirname(path.abspath(quicktest_py)) print('Found quicktest.py in', project_location) print('##vso[task.setvariable variable=projectRoot]{}'.format(project_location)) - script: | python -m pip install --upgrade pip setuptools wheel pip install -c constraints-Django$(DJANGO_VERSION).txt -r requirements.txt pip install unittest-xml-reporting displayName: 'Install prerequisites' - script: | pushd '$(projectRoot)' python quicktest.py helpdesk displayName: 'Run tests'