parameters:
  directory: ''
  toxenv: 'ALL'
  
steps:
- template: pip_install.yml
  parameters:
    packages: tox

- script: |
    set -eux -o pipefail
    tox -c ${{ parameters.directory }} -e ${{ parameters.toxenv }} -- --junitxml=results.xml
  displayName: 'Run tests'

- task: PublishTestResults@2
  inputs:
    testResultsFiles: '${{ parameters.directory }}/results.xml'
    testRunTitle: '${{ parameters.directory }}'
  displayName: 'Publish results'
  condition: succeededOrFailed()
