Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eac76a5

Browse files
committed
Move optional dependencies to a separate set
1 parent 5115114 commit eac76a5

7 files changed

Lines changed: 29 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,19 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest]
1818
python-version: ["3.7", "3.8", "3.9", "3.10"]
19+
deps: [test_extra]
1920
# Test all on ubuntu, test ends on macos
2021
include:
2122
- os: macos-latest
2223
python-version: "3.7"
24+
deps: test_extra
2325
- os: macos-latest
2426
python-version: "3.10"
27+
deps: test_extra
28+
# Tests minimal dependencies set
29+
- os: ubuntu-latest
30+
python-version: "3.10"
31+
deps: test
2532

2633
steps:
2734
- uses: actions/checkout@v2
@@ -30,15 +37,13 @@ jobs:
3037
with:
3138
python-version: ${{ matrix.python-version }}
3239
- name: Install latex
33-
if: runner.os == 'Linux'
40+
if: runner.os == 'Linux' && matrix.deps == 'test_extra'
3441
run: sudo apt-get -yq -o Acquire::Retries=3 --no-install-suggests --no-install-recommends install texlive dvipng
3542
- name: Install and update Python dependencies
3643
run: |
3744
python -m pip install --upgrade pip setuptools wheel
38-
python -m pip install --upgrade -e file://$PWD#egg=ipython[test]
39-
python -m pip install --upgrade --upgrade-strategy eager trio curio
40-
python -m pip install --upgrade pytest pytest-cov pytest-trio 'matplotlib!=3.2.0' pandas
41-
python -m pip install --upgrade check-manifest pytest-cov anyio
45+
python -m pip install --upgrade -e .[${{ matrix.deps }}]
46+
python -m pip install --upgrade check-manifest pytest-cov
4247
- name: Check manifest
4348
run: check-manifest
4449
- name: pytest

IPython/core/tests/test_magic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ def test_extension():
742742

743743

744744
def test_notebook_export_json():
745+
pytest.importorskip("nbformat")
745746
_ip = get_ipython()
746747
_ip.history_manager.reset() # Clear any existing history.
747748
cmds = ["a=1", "def b():\n return a**2", "print('noël, été', b())"]

IPython/core/tests/test_run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ def test_ignore_sys_exit(self):
381381

382382
def test_run_nb(self):
383383
"""Test %run notebook.ipynb"""
384+
pytest.importorskip("nbformat")
384385
from nbformat import v4, writes
385386
nb = v4.new_notebook(
386387
cells=[
@@ -397,6 +398,7 @@ def test_run_nb(self):
397398

398399
def test_run_nb_error(self):
399400
"""Test %run notebook.ipynb error"""
401+
pytest.importorskip("nbformat")
400402
from nbformat import v4, writes
401403
# %run when a file name isn't provided
402404
pytest.raises(Exception, _ip.magic, "run")

IPython/lib/display.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class Audio(DisplayObject):
6666
Examples
6767
--------
6868
69+
>>> import pytest
70+
>>> np = pytest.importorskip("numpy")
71+
6972
Generate a sound
7073
7174
>>> import numpy as np

IPython/terminal/tests/test_help.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Copyright (c) IPython Development Team.
44
# Distributed under the terms of the Modified BSD License.
55

6+
import pytest
67
import IPython.testing.tools as tt
78

89

@@ -25,4 +26,5 @@ def test_locate_profile_help():
2526
tt.help_all_output_test("locate profile")
2627

2728
def test_trust_help():
29+
pytest.importorskip("nbformat")
2830
tt.help_all_output_test("trust")

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ init:
3131
install:
3232
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
3333
- python -m pip install --upgrade setuptools pip
34-
- pip install pytest pytest-cov pytest-trio matplotlib pandas
35-
- pip install -e .[test]
34+
- pip install pytest-cov
35+
- pip install -e .[test_extra]
3636
test_script:
3737
- pytest --color=yes -ra --cov --cov-report=xml
3838
on_finish:

setup.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,18 @@
178178
"pytest",
179179
"testpath",
180180
"pygments",
181+
],
182+
test_extra=[
183+
"pytest",
184+
"testpath",
185+
"curio",
186+
"matplotlib!=3.2.0",
181187
"nbformat",
182188
"ipykernel",
183189
"numpy>=1.17",
190+
"pandas",
191+
"pygments",
192+
"trio",
184193
],
185194
terminal=[],
186195
kernel=["ipykernel"],

0 commit comments

Comments
 (0)