summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarrod Millman <jarrod.millman@gmail.com>2021-10-24 18:54:04 -0700
committerGitHub <noreply@github.com>2021-10-24 18:54:04 -0700
commit365cf572089909f5498cda404fbc4455cac8ee7a (patch)
tree2e3fe913cac1a9f07fb7cfc362bb7038c3ff9d52
parent73ae7545dba0a466df8eb793e3d434de4b2415ca (diff)
downloadnetworkx-365cf572089909f5498cda404fbc4455cac8ee7a.tar.gz
Test on Python 3.10 (#4807)
* Test on Python 3.10 * Fix tests
-rw-r--r--.github/workflows/test.yml8
-rw-r--r--networkx/algorithms/approximation/tests/test_traveling_salesman.py11
-rw-r--r--networkx/algorithms/tests/test_tournament.py3
-rw-r--r--networkx/conftest.py2
-rw-r--r--requirements/default.txt6
5 files changed, 22 insertions, 8 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a9198f31..dfa72863 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu, macos, windows]
- python-version: [3.8, 3.9]
+ python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
@@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
os: [ubuntu, macos]
- python-version: [pypy-3.8]
+ python-version: ['pypy-3.8']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
@@ -57,7 +57,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
- python-version: [3.8, 3.9]
+ python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
@@ -109,7 +109,7 @@ jobs:
strategy:
matrix:
os: [ubuntu, macos]
- python-version: [3.8, 3.9]
+ python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
diff --git a/networkx/algorithms/approximation/tests/test_traveling_salesman.py b/networkx/algorithms/approximation/tests/test_traveling_salesman.py
index 5b8ff39e..56574f63 100644
--- a/networkx/algorithms/approximation/tests/test_traveling_salesman.py
+++ b/networkx/algorithms/approximation/tests/test_traveling_salesman.py
@@ -391,6 +391,7 @@ def test_held_karp_ascent():
import networkx.algorithms.approximation.traveling_salesman as tsp
np = pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
# Adjacency matrix from page 1153 of the 1970 Held and Karp paper
# which have been edited to be directional, but also symmetric
@@ -427,6 +428,7 @@ def test_ascent_fractional_solution():
import networkx.algorithms.approximation.traveling_salesman as tsp
np = pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
# This version of Figure 2 has all of the edge weights multiplied by 100
# and is a complete directed graph with infinite edge weights for the
@@ -482,6 +484,7 @@ def test_ascent_method_asymmetric():
import networkx.algorithms.approximation.traveling_salesman as tsp
np = pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
G_array = np.array(
[
@@ -516,6 +519,7 @@ def test_ascent_method_asymmetric_2():
import networkx.algorithms.approximation.traveling_salesman as tsp
np = pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
G_array = np.array(
[
@@ -555,6 +559,7 @@ def test_held_karp_ascent_asymmetric_3():
import networkx.algorithms.approximation.traveling_salesman as tsp
np = pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
G_array = np.array(
[
@@ -593,6 +598,7 @@ def test_held_karp_ascent_fractional_asymmetric():
import networkx.algorithms.approximation.traveling_salesman as tsp
np = pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
G_array = np.array(
[
@@ -651,6 +657,7 @@ def test_spanning_tree_distribution():
import networkx.algorithms.approximation.traveling_salesman as tsp
pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
z_star = {
(0, 1): 5 / 12,
@@ -705,6 +712,7 @@ def test_sample_spanning_tree():
from math import exp
pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
gamma = {
(0, 1): -0.6383,
@@ -832,6 +840,7 @@ def test_asadpour_tsp():
# This version of Figure 2 has all of the edge weights multiplied by 100
# and the 0 weight edges have a weight of 1.
pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
edge_list = [
(0, 1, 100),
@@ -900,6 +909,7 @@ def test_asadpour_real_world():
always starts at city 0.
"""
np = pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
G_array = np.array(
[
@@ -947,6 +957,7 @@ def test_asadpour_real_world_path():
nonstop flight. The brute force solution found the optimal tour to cost $872
"""
np = pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
G_array = np.array(
[
diff --git a/networkx/algorithms/tests/test_tournament.py b/networkx/algorithms/tests/test_tournament.py
index 42a31f9b..b53152be 100644
--- a/networkx/algorithms/tests/test_tournament.py
+++ b/networkx/algorithms/tests/test_tournament.py
@@ -120,7 +120,8 @@ def test_score_sequence_triangle():
def test_tournament_matrix():
np = pytest.importorskip("numpy")
- npt = pytest.importorskip("numpy.testing")
+ pytest.importorskip("scipy")
+ npt = np.testing
G = DiGraph([(0, 1)])
m = tournament_matrix(G)
npt.assert_array_equal(m.todense(), np.array([[0, 1], [-1, 0]]))
diff --git a/networkx/conftest.py b/networkx/conftest.py
index 3b189a71..de72cfd2 100644
--- a/networkx/conftest.py
+++ b/networkx/conftest.py
@@ -272,6 +272,7 @@ needs_scipy = [
"algorithms/communicability_alg.py",
"algorithms/link_analysis/hits_alg.py",
"algorithms/link_analysis/pagerank_alg.py",
+ "algorithms/node_classification/__init__.py",
"algorithms/node_classification/hmn.py",
"algorithms/node_classification/lgc.py",
"algorithms/similarity.py",
@@ -280,6 +281,7 @@ needs_scipy = [
"generators/spectral_graph_forge.py",
"linalg/algebraicconnectivity.py",
"linalg/attrmatrix.py",
+ "linalg/bethehessianmatrix.py",
"linalg/graphmatrix.py",
"linalg/modularitymatrix.py",
"linalg/spectrum.py",
diff --git a/requirements/default.txt b/requirements/default.txt
index 691b34e0..88195c88 100644
--- a/requirements/default.txt
+++ b/requirements/default.txt
@@ -1,4 +1,4 @@
numpy>=1.19
-scipy>=1.5,!=1.6.1
-matplotlib>=3.3
-pandas>=1.1
+scipy>=1.5,!=1.6.1; python_version<'3.10'
+matplotlib>=3.3; python_version<'3.10'
+pandas>=1.1; python_version<'3.10'