8000 Set up CI with Azure Pipelines (#12617) · matplotlib/matplotlib@531bd02 · GitHub
[go: up one dir, main page]

Skip to content

Commit 531bd02

Browse files
azure-pipelines[bot]tacaswell
authored andcommitted
Set up CI with Azure Pipelines (#12617)
* Set up CI with Azure Pipelines * Update azure-pipelines.yml * TST: make sure all figures are closed before testing show * CI: update how dependencies are installed * CI: start xserver * CI: remove all of the GUI installation again * TST: open temporary file as text (not binary) * TST: add missing import No idea why this passes anywhere else... * TST: use localfreetype on azure * TST: tweak imports in test script + add check for server up * TST: move over all flags from travis invocation of pytest * TST: add debugging prints * TST: skip some tests on azure * TST: more debugging prints * TST: skip tests based on user name? * CI: print env right before testing * TST: print out the full environment * CI: have I finally found a way to identify we are on azure?! * CI: Debugging prints to sort out how to make it skip * TST: pytest marks work better if you use them a decorators 🐑 * TST: provide reasons for skipping tests
1 parent bcb372b commit 531bd02

File tree

4 files changed

+66
-2
lines changed

4 files changed

+66
-2
lines changed

azure-pipelines.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Python package
2+
# Create and test a Python package on multiple Python versions.
3+
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5+
6+
jobs:
7+
8+
- job: 'Test'
9+
pool:
10+
vmImage: 'Ubuntu 16.04'
11+
strategy:
12+
matrix:
13+
Python35:
14+
python.version: '3.5'
15+
Python36:
16+
python.version: '3.6'
17+
Python37:
18+
python.version: '3.7'
19+
maxParallel: 4
20+
21+
steps:
22+
- task: UsePythonVersion@0
23+
inputs:
24+
versionSpec: '$(python.version)'
25+
architecture: 'x64'
26+
27+
- script: |
28+
29+
python -m pip install --upgrade pip
30+
pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt
31+
32+
displayName: 'Install dependencies'
33+
34+
- script: |
35+
36+
export MPLLOCALFREETYPE=1
37+
pip install -ve .
38+
39+
displayName: "Install self"
40+
41+
- script: env
42+
displayName: 'print env'
43+
44+
- script: |
45+
env
46+
pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2
47+
displayName: 'pytest'
48+
49+
- task: PublishTestResults@2
50+
inputs:
51+
testResultsFiles: '**/test-results.xml'
52+
testRunTitle: 'Python $(python.version)'
53+
condition: succeededOrFailed()

lib/matplotlib/tests/test_backend_bases.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import matplotlib.pyplot as plt
66
import matplotlib.transforms as transforms
77
import matplotlib.path as path
8-
8+
import os
99
import numpy as np
1010
import pytest
1111

@@ -58,8 +58,11 @@ def test_get_default_filename(tmpdir):
5858

5959

6060
@pytest.mark.backend('pdf')
61+
@pytest.mark.skipif('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI' in os.environ,
62+
reason="this test fails an azure for unknown reasons")
6163
def test_non_gui_warning():
6264
plt.subplots()
65+
6366
with pytest.warns(UserWarning) as rec:
6467
plt.show()
6568
assert len(rec) == 1

lib/matplotlib/tests/test_backend_nbagg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def _notebook_run(nb_file):
1313
"""Execute a notebook via nbconvert and collect output.
1414
:returns (parsed nb object, execution errors)
1515
"""
16-
with tempfile.NamedTemporaryFile(suffix=".ipynb") as fout:
16+
with tempfile.NamedTemporaryFile(suffix=".ipynb",
17+
mode='w+t') as fout:
1718
args = ["jupyter", "nbconvert", "--to", "notebook", "--execute",
1819
"--ExecutePreprocessor.timeout=500",
1920
"--output", fout.name, nb_file]

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import importlib
2+
import importlib.util
23
import os
34
import signal
45
import subprocess
@@ -46,6 +47,7 @@ def _get_testable_interactive_backends():
4647
# we directly invoke it from the superclass instead.
4748
_test_script = """\
4849
import importlib
50+
import importlib.util
4951
import sys
5052
from unittest import TestCase
5153
@@ -115,6 +117,8 @@ def test_interactive_backend(backend):
115117
pytest.fail("The subprocess returned an error.")
116118

117119

120+
@pytest.mark.skipif('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI' in os.environ,
121+
reason="this test fails an azure for unknown reasons")
118122
@pytest.mark.skipif(os.name == "nt", reason="Cannot send SIGINT on Windows.")
119123
def test_webagg():
120124
pytest.importorskip("tornado")
@@ -125,6 +129,9 @@ def test_webagg():
125129
timeout = time.perf_counter() + _test_timeout
126130
while True:
127131
try:
132+
retcode = proc.poll()
133+
# check that the subprocess for the server is not dead
134+
assert retcode is None
128135
conn = urllib.request.urlopen(url)
129136
break
130137
except urllib.error.URLError:

0 commit comments

Comments
 (0)
0