summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-06-13 13:13:16 +0200
committerMichał Górny <mgorny@gentoo.org>2020-06-13 13:14:05 +0200
commit0feb2320f929f3c2a8bddae488c06a17f9bfddac (patch)
tree3bdb6425675b4279d7a0538cf08ebb52f28ba2cd /dev-python/networkx
parentdev-python/pydot: Port to py3.9 (diff)
downloadgentoo-0feb2320f929f3c2a8bddae488c06a17f9bfddac.tar.gz
gentoo-0feb2320f929f3c2a8bddae488c06a17f9bfddac.tar.bz2
gentoo-0feb2320f929f3c2a8bddae488c06a17f9bfddac.zip
dev-python/networkx: Fix tests
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/networkx')
-rw-r--r--dev-python/networkx/files/networkx-2.4-py38.patch84
-rw-r--r--dev-python/networkx/networkx-2.4-r1.ebuild54
2 files changed, 107 insertions, 31 deletions
diff --git a/dev-python/networkx/files/networkx-2.4-py38.patch b/dev-python/networkx/files/networkx-2.4-py38.patch
new file mode 100644
index 000000000000..9ce3003d1042
--- /dev/null
+++ b/dev-python/networkx/files/networkx-2.4-py38.patch
@@ -0,0 +1,84 @@
+From 488e824439124f4dd52f8230c452a3df681b1bab Mon Sep 17 00:00:00 2001
+From: Steve Kowalik <steven@wedontsleep.org>
+Date: Fri, 15 Nov 2019 13:48:33 +1100
+Subject: [PATCH] Fix test_numpy_type to pass under Python 3.8
+
+readwrite.tests.test_gexf.TestGEXF.test_numpy_type failed under Python
+3.8 due to ordering of XML attributes, handle it as per f75dbe8. Also
+change travis to no longer allow failures under 3.8.
+
+Fixes #3720
+---
+ .travis.yml | 2 --
+ networkx/readwrite/tests/test_gexf.py | 51 ++++++++++++++++++++++++++-
+ 2 files changed, 50 insertions(+), 3 deletions(-)
+
+diff --git a/networkx/readwrite/tests/test_gexf.py b/networkx/readwrite/tests/test_gexf.py
+index afc40111ce..f16504c047 100644
+--- a/networkx/readwrite/tests/test_gexf.py
++++ b/networkx/readwrite/tests/test_gexf.py
+@@ -404,7 +404,8 @@ def test_numpy_type(self):
+ nx.set_node_attributes(G, {n: n for n in numpy.arange(4)}, 'number')
+ G[0][1]['edge-number'] = numpy.float64(1.1)
+
+- expected = """<gexf version="1.2" xmlns="http://www.gexf.net/1.2draft"\
++ if sys.version_info < (3, 8):
++ expected = """<gexf version="1.2" xmlns="http://www.gexf.net/1.2draft"\
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation\
+ ="http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd">
+ <meta lastmodifieddate="{}">
+@@ -449,6 +450,54 @@ def test_numpy_type(self):
+ <edge id="2" source="2" target="3" />
+ </edges>
+ </graph>
++</gexf>""".format(time.strftime('%Y-%m-%d'), nx.__version__)
++ else:
++ expected = """<gexf xmlns="http://www.gexf.net/1.2draft"\
++ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation\
++="http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd"\
++ version="1.2">
++ <meta lastmodifieddate="{}">
++ <creator>NetworkX {}</creator>
++ </meta>
++ <graph defaultedgetype="undirected" mode="static" name="">
++ <attributes mode="static" class="edge">
++ <attribute id="1" title="edge-number" type="float" />
++ </attributes>
++ <attributes mode="static" class="node">
++ <attribute id="0" title="number" type="int" />
++ </attributes>
++ <nodes>
++ <node id="0" label="0">
++ <attvalues>
++ <attvalue for="0" value="0" />
++ </attvalues>
++ </node>
++ <node id="1" label="1">
++ <attvalues>
++ <attvalue for="0" value="1" />
++ </attvalues>
++ </node>
++ <node id="2" label="2">
++ <attvalues>
++ <attvalue for="0" value="2" />
++ </attvalues>
++ </node>
++ <node id="3" label="3">
++ <attvalues>
++ <attvalue for="0" value="3" />
++ </attvalues>
++ </node>
++ </nodes>
++ <edges>
++ <edge source="0" target="1" id="0">
++ <attvalues>
++ <attvalue for="1" value="1.1" />
++ </attvalues>
++ </edge>
++ <edge source="1" target="2" id="1" />
++ <edge source="2" target="3" id="2" />
++ </edges>
++ </graph>
+ </gexf>""".format(time.strftime('%Y-%m-%d'), nx.__version__)
+ obtained = '\n'.join(nx.generate_gexf(G))
+ assert expected == obtained
diff --git a/dev-python/networkx/networkx-2.4-r1.ebuild b/dev-python/networkx/networkx-2.4-r1.ebuild
index 081e31c0fa43..fa234268a45d 100644
--- a/dev-python/networkx/networkx-2.4-r1.ebuild
+++ b/dev-python/networkx/networkx-2.4-r1.ebuild
@@ -3,8 +3,7 @@
EAPI=7
-# networkx-2.4 supports up to python3_8
-PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_COMPAT=( python3_{6..8} )
inherit distutils-r1 virtualx
DESCRIPTION="Python tools to manipulate graphs and complex networks"
@@ -17,41 +16,41 @@ KEYWORDS="~amd64 ~arm64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-
IUSE="examples extras pandas scipy test xml yaml"
RESTRICT="!test? ( test )"
-REQUIRED_USE="
- test? ( extras pandas scipy xml yaml )"
-
-COMMON_DEPEND="
+RDEPEND="
+ >=dev-python/decorator-4.3.0[${PYTHON_USEDEP}]
>=dev-python/matplotlib-2.2.2[${PYTHON_USEDEP}]
extras? (
>=dev-python/pydot-1.2.4[${PYTHON_USEDEP}]
- >=dev-python/pygraphviz-1.5[${PYTHON_USEDEP}]
- >=sci-libs/gdal-1.10.0[python,${PYTHON_USEDEP}]
+ $(python_gen_cond_dep '
+ >=dev-python/pygraphviz-1.5[${PYTHON_USEDEP}]
+ >=sci-libs/gdal-1.10.0[python,${PYTHON_USEDEP}]
+ ' python3_{6,7,8})
)
pandas? (
- $(python_gen_cond_dep '>=dev-python/pandas-0.23.3[${PYTHON_USEDEP}]' python3_{6,7})
+ $(python_gen_cond_dep '
+ >=dev-python/pandas-0.23.3[${PYTHON_USEDEP}]
+ ' python3_{6,7,8})
)
scipy? ( >=sci-libs/scipy-1.1.0[${PYTHON_USEDEP}] )
xml? ( >=dev-python/lxml-4.2.3[${PYTHON_USEDEP}] )
yaml? ( >=dev-python/pyyaml-3.13[${PYTHON_USEDEP}] )"
-DEPEND="
- dev-python/setuptools[${PYTHON_USEDEP}]
- >=dev-python/decorator-4.3.0[${PYTHON_USEDEP}]
- ${COMMON_DEPEND}
- test? (
- dev-python/nose[${PYTHON_USEDEP}]
- )"
-RDEPEND="
- >=dev-python/decorator-4.3.0[${PYTHON_USEDEP}]
- ${COMMON_DEPEND}
- examples? (
- dev-python/pyparsing[${PYTHON_USEDEP}]
- )"
+
+distutils_enable_tests pytest
PATCHES=(
+ "${FILESDIR}"/${P}-py38.patch
)
-python_test() {
- virtx nosetests -vv || die "tests failed with ${EPYTHON}"
+src_prepare() {
+ # incompatible deps?
+ sed -e 's:test_multigraph_edgelist_tuples:_&:' \
+ -i networkx/drawing/tests/test_pylab.py || die
+
+ distutils-r1_src_prepare
+}
+
+src_test() {
+ virtx distutils-r1_src_test
}
python_install_all() {
@@ -59,10 +58,3 @@ python_install_all() {
distutils-r1_python_install_all
}
-
-pkg_postinst() {
- if use pandas && use python_targets_python3_8; then
- ewarn "The pandas functionality in ${P} will not work with python3.8 as"
- ewarn "dev-python/pandas does not have support for python3.8 yet"
- fi
-}