# This task tests individual platforms and versions
steps:

- template: python.yml
  parameters:
    version: '$(python.version)'

- template: jdk.yml
  parameters:
    version: '$(jdk.version)'

- template: sdist.yml

- script: |
    python -m pip install -e .
  displayName: 'Build/install module'

- script: |
    pip install numpy jedi typing_extensions
    python -c "import jpype"
  displayName: 'Check module'

- script: |
    pip install setuptools
    python setup.py test_java
    pip install -r test-requirements.txt
  displayName: 'Install test'

- script: |
    python -m pip install -U pytest
    python -m pytest -v --junit-xml=build/test/test.xml test/jpypetest --checkjni
  displayName: 'Test JDK $(jdk.version) and Python $(python.version)'
  condition: eq(variables['jpypetest.fast'], 'false')

- script: |
    python -m pytest -v --junit-xml=build/test/test.xml test/jpypetest --checkjni --fast
  displayName: 'Test JDK $(jdk.version) and Python $(python.version) (fast)'
  condition: eq(variables['jpypetest.fast'], 'true')

# presence of jpype/ seems to confuse entry_points so `cd` elsewhere
- script: |
    pip install .
    mkdir empty
    cd empty
    python -m PyInstaller.utils.run_tests --include_only jpype._pyinstaller.
  displayName: 'Test PyInstaller result'

- task: PublishTestResults@2
  condition: succeededOrFailed()
  inputs:
     testResultsFiles: 'build/test/test.xml'
     testRunTitle: 'Publish test results for Python $(python.version) with JDK $(jdk.version)'
