summaryrefslogtreecommitdiff
path: root/.azure-pipelines/steps/run-tests-windows.yml
blob: 4908c0ec70a96187d392c16322eb07e6acdfb59e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
parameters:
  runIntegrationTests:
  useVenv: false

steps:
- task: UsePythonVersion@0
  displayName: Use Python $(python.version)
  inputs:
    versionSpec: '$(python.version)'
    architecture: '$(python.architecture)'

- task: PowerShell@2
  inputs:
    filePath: .azure-pipelines/scripts/New-RAMDisk.ps1
    arguments: "-Drive R -Size 1GB"
  displayName: Setup RAMDisk

- powershell: |
    mkdir R:\Temp
    $acl = Get-Acl "R:\Temp"
    $rule = New-Object System.Security.AccessControl.FileSystemAccessRule(
        "Everyone", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow"
    )
    $acl.AddAccessRule($rule)
    Set-Acl "R:\Temp" $acl
  displayName: Set RAMDisk Permissions

- bash: pip install --upgrade setuptools tox virtualenv
  displayName: Install Tox

- script: tox -e py -- -m unit -n auto --junit-xml=junit/unit-test.xml
  env:
    TEMP: "R:\\Temp"
  displayName: Tox run unit tests

- ${{ if eq(parameters.runIntegrationTests, 'true') }}:
  - powershell: |
      # Fix Git SSL errors
      pip install certifi tox
      python -m certifi > cacert.txt
      $env:GIT_SSL_CAINFO = $(Get-Content cacert.txt)

      # Shorten paths to get under MAX_PATH or else integration tests will fail
      # https://bugs.python.org/issue18199
      $env:TEMP = "R:\Temp"

      tox -e py -- $env:USE_VENV_ARG -m integration -n auto --duration=5 --junit-xml=junit/integration-test.xml
    displayName: Tox run integration tests
    env:
      ${{ if eq(parameters.useVenv, 'true') }}:
        USE_VENV_ARG: "--use-venv"

- task: PublishTestResults@2
  displayName: Publish Test Results
  inputs:
    testResultsFiles: junit/*.xml
    testRunTitle: 'Python $(python.version)'
  condition: succeededOrFailed()