@@ -5,84 +5,85 @@ name: pip
55
66on :
77 push :
8- branches : [main]
8+ branches : [ main ]
99 pull_request :
10- branches : [main]
10+ branches : [ main ]
1111
1212jobs :
1313 build :
14+
1415 runs-on : ${{ matrix.os }}
1516 strategy :
1617 matrix :
17- python-version : [" 3.11", " 3.12" ]
18- numpy : ['"numpy<2.0"', " numpy" ]
19- os : [ubuntu-latest]
18+ python-version : [' 3.11', ' 3.12' ]
19+ numpy : ['"numpy<2.0"', ' numpy' ]
20+ os : [ubuntu-latest]
2021 pytest : [pytest]
21- pre : ["", " --pre" ]
22+ pre : ['', ' --pre' ]
2223
2324 steps :
24- # actions/setup-python@v5 has built-in functionality for caching and restoring dependencies.
25- - uses : actions/checkout@v4
26- - name : Set up Python ${{ matrix.python-version }}
27- uses : actions/setup-python@v5
28- with :
29- python-version : ${{ matrix.python-version }}
30- cache : " pip" # caching pip dependencies
31-
32- # Install numpy and pytest
33- - name : Install core dependencies
34- run : |
35- python -m pip install --upgrade pip
36- python -m pip install ${{matrix.pytest}} ${{matrix.pre}}
37- python -m pip install -e . ${{matrix.pre}}
38- python -m pip install ${{matrix.numpy}} ${{matrix.pre}}
39-
40- - name : Echo versions
41- run : |
42- python -m pytest --version
43- python -c"import numpy; print(f'{numpy.__version__ = }')"
44-
45- # Run self-tests without Scipy and MPL
46- # Tests that require Scipy and MPL will be skipped
47- - name : Self-test without SciPy and MPL
48- run : |
49- pytest --pyargs scipy_doctest -v
50-
51- - name : Self-test CLI without SciPy and MPL
52- run : |
53- python -m scipy_doctest scipy_doctest/tests/finder_cases.py -vv
54-
55- # Install Scipy and MPL
56- - name : Install optional dependencies
57- run : |
58- python -m pip install -e '.[test]'
59-
60- # Tests that require Scipy and MPL can now run
61- - name : Self-test with SciPy and MPL
62- run : |
63- pytest --pyargs scipy_doctest -v
64-
65- - name : Self-test CLI with SciPy and MPL
66- run : |
67- python -m scipy_doctest scipy_doctest/tests/finder_cases.py -vv
68-
69- - name : Test testfile CLI
70- run : |
71- python -m scipy_doctest ./scipy_doctest/tests/scipy_ndimage_tutorial_clone.rst -v
72-
73- - name : Run testmod a scipy submodule
74- run : |
75- python -c'from scipy.linalg import _basic; from scipy_doctest import testmod; testmod(_basic, verbose=True)'
76-
77- - name : Run testmod a scipy submodule -- Public API onlly
78- run : |
79- python -m pip install pooch
80- python -c'from scipy import ndimage; from scipy_doctest import testmod; testmod(ndimage, verbose=True, strategy="api")'
81-
82- - name : Test pytest plugin
83- # This test will fail in a venv where scipy_doctest has not been installed and the plugin has not been activated
84- run : |
85- test_files=("scipy_doctest/tests/module_cases.py" "scipy_doctest/tests/stopwords_cases.py" "scipy_doctest/tests/local_file_cases.py")
86- for file in "${test_files[@]}"; do
87- python -m pytest "${file}" --doctest-modules
88- done
25+ # actions/setup-python@v5 has built-in functionality for caching and restoring dependencies.
26+ - uses : actions/checkout@v4
27+ - name : Set up Python ${{ matrix.python-version }}
28+ uses : actions/setup-python@v5
29+ with :
30+ python-version : ${{ matrix.python-version }}
31+ cache : ' pip' # caching pip dependencies
32+
33+ # Install numpy and pytest
34+ - name : Install core dependencies
35+ run : |
36+ python -m pip install --upgrade pip
37+ python -m pip install ${{matrix.pytest}} ${{matrix.pre}}
38+ python -m pip install -e . ${{matrix.pre}}
39+ python -m pip install ${{matrix.numpy}} ${{matrix.pre}}
40+
41+ - name : Echo versions
42+ run : |
43+ python -m pytest --version
44+ python -c"import numpy; print(f'{numpy.__version__ = }')"
45+
46+ # Run self-tests without Scipy and MPL
47+ # Tests that require Scipy and MPL will be skipped
48+ - name : Self-test without SciPy and MPL
49+ run : |
50+ pytest --pyargs scipy_doctest -v
51+
52+ - name : Self-test CLI without SciPy and MPL
53+ run : |
54+ python -m scipy_doctest scipy_doctest/tests/finder_cases.py -vv
55+
56+ # Install Scipy and MPL
57+ - name : Install optional dependencies
58+ run : |
59+ python -m pip install -e '.[test]'
60+
61+ # Tests that require Scipy and MPL can now run
62+ - name : Self-test with SciPy and MPL
63+ run : |
64+ pytest --pyargs scipy_doctest -v
65+
66+ - name : Self-test CLI with SciPy and MPL
67+ run : |
68+ python -m scipy_doctest scipy_doctest/tests/finder_cases.py -vv
69+
70+ - name : Test testfile CLI
71+ run : |
72+ python -m scipy_doctest ./scipy_doctest/tests/scipy_ndimage_tutorial_clone.rst -v
73+
74+ - name : Run testmod a scipy submodule
75+ run : |
76+ python -c'from scipy.linalg import _basic; from scipy_doctest import testmod; testmod(_basic, verbose=True)'
77+
78+ - name : Run testmod a scipy submodule -- Public API onlly
79+ run : |
80+ python -m pip install pooch
81+ python -c'from scipy import ndimage; from scipy_doctest import testmod; testmod(ndimage, verbose=True, strategy="api")'
82+
83+ - name : Test pytest plugin
84+ # This test will fail in a venv where scipy_doctest has not been installed and the plugin has not been activated
85+ run : |
86+ test_files=("scipy_doctest/tests/module_cases.py" "scipy_doctest/tests/stopwords_cases.py" "scipy_doctest/tests/local_file_cases.py")
87+ for file in "${test_files[@]}"; do
88+ python -m pytest "${file}" --doctest-modules
89+ done
0 commit comments