steps:
  - pwsh: |
      ((Get-Content -path "$(BUILD.REPOSITORY.LOCALPATH)\.env.tmp" -Raw) -replace 'IOTHUB_CONNECTION_STRING=".*"','IOTHUB_CONNECTION_STRING="$(IOTHUB_CONNECTION_STRING)"' -replace 'DEVICE_CONNECTION_STRING=".*"','DEVICE_CONNECTION_STRING="$(DEVICE_CONNECTION_STRING)"' -replace 'CONTAINER_REGISTRY_SERVER=".*"','CONTAINER_REGISTRY_SERVER="$(CONTAINER_REGISTRY_SERVER)"' -replace 'CONTAINER_REGISTRY_USERNAME=".*"','CONTAINER_REGISTRY_USERNAME="$(CONTAINER_REGISTRY_USERNAME)"' -replace 'CONTAINER_REGISTRY_PASSWORD=".*"','CONTAINER_REGISTRY_PASSWORD="$(CONTAINER_REGISTRY_PASSWORD)"') | Set-Content -Path "$(BUILD.REPOSITORY.LOCALPATH)\.env.tmp"
    displayName: "Update .env.tmp file"

  - task: UsePythonVersion@0
    inputs:
      versionSpec: "$(python.version)"
      addToPath: true
      architecture: "x64"

  - pwsh: |
      npm i -g iothub-explorer yo generator-azure-iot-edge-module
      az --version
      az extension add --name azure-iot
    displayName: "Install IoT Hub explorer, Yeoman and Azure IoT Edge Node.js module generator packages"

  - pwsh: |
      mkdir C:\registry
      docker run -d -p 5000:5000 --restart=always --name registry -v C:\registry:C:\registry stefanscherer/registry-windows:2.6.2
    displayName: "Pull and run local registry containers"

  - pwsh: |
      pip install tox
      tox -e "$(TOXENV)"
    displayName: "Run tests against iotedgedev source code"
