summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-11-26 21:27:42 +0100
committerMichał Górny <mgorny@gentoo.org>2021-11-26 21:30:17 +0100
commit2140875c4dafa046e8a658bde1ea0c2defc34faf (patch)
treedcd4d98725558d65769bbf6abf6ae0664789774f
parentdev-python/pylint: Keyword 2.12.1 ia64, #827326 (diff)
downloadgentoo-2140875c4dafa046e8a658bde1ea0c2defc34faf.tar.gz
gentoo-2140875c4dafa046e8a658bde1ea0c2defc34faf.tar.bz2
gentoo-2140875c4dafa046e8a658bde1ea0c2defc34faf.zip
dev-python/nltk: Fix test failure
Closes: https://bugs.gentoo.org/819921 Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--dev-python/nltk/files/nltk-3.6.5-test.patch28
-rw-r--r--dev-python/nltk/nltk-3.6.5.ebuild7
2 files changed, 32 insertions, 3 deletions
diff --git a/dev-python/nltk/files/nltk-3.6.5-test.patch b/dev-python/nltk/files/nltk-3.6.5-test.patch
new file mode 100644
index 000000000000..ea4d9512fa74
--- /dev/null
+++ b/dev-python/nltk/files/nltk-3.6.5-test.patch
@@ -0,0 +1,28 @@
+From 9502cb3b5e43a787a16bc2f63ec34c69f9b151c6 Mon Sep 17 00:00:00 2001
+From: Tom Aarsen <Cubiegamedev@gmail.com>
+Date: Tue, 19 Oct 2021 16:49:36 +0200
+Subject: [PATCH] Skip doctest for printing out stopword languages
+
+People with outdated nltk_data will fail these tests, and this test is very vulnerable to updates in nltk_data
+---
+ nltk/test/corpus.doctest | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/nltk/test/corpus.doctest b/nltk/test/corpus.doctest
+index 536ef452f..47a6fea2f 100644
+--- a/nltk/test/corpus.doctest
++++ b/nltk/test/corpus.doctest
+@@ -385,8 +385,8 @@ examples illustrate the use of the wordlist corpora:
+ >>> words.words('en')
+ ['A', 'a', 'aa', 'aal', 'aalii', 'aam', 'Aani', 'aardvark', 'aardwolf', ...]
+
+- >>> stopwords.fileids()
+- ['arabic', 'azerbaijani', 'danish', 'dutch', 'english', 'finnish', 'french', ...]
++ >>> stopwords.fileids() # doctest: +SKIP
++ ['arabic', 'azerbaijani', 'bengali', 'danish', 'dutch', 'english', 'finnish', 'french', ...]
+ >>> sorted(stopwords.words('portuguese'))
+ ['a', 'ao', 'aos', 'aquela', 'aquelas', 'aquele', 'aqueles', ...]
+ >>> names.fileids()
+--
+2.34.1
+
diff --git a/dev-python/nltk/nltk-3.6.5.ebuild b/dev-python/nltk/nltk-3.6.5.ebuild
index 11dd1a3283d2..b706aa229c71 100644
--- a/dev-python/nltk/nltk-3.6.5.ebuild
+++ b/dev-python/nltk/nltk-3.6.5.ebuild
@@ -39,14 +39,15 @@ PDEPEND="dev-python/nltk-data"
distutils_enable_tests pytest
src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}"/${P}-test.patch
+ )
+
# requires unpackaged pycrfsuite
sed -i -e '/>>>/s@$@ # doctest: +SKIP@' nltk/tag/crf.py || die
# replace fetching from network with duplicate file URL
sed -e 's@https://raw.githubusercontent.com/nltk/nltk/develop/nltk/test/toy.cfg@nltk:grammars/sample_grammars/toy.cfg@' \
-i nltk/test/data.doctest || die
- # requires X and hangs in Xvfb
- sed -e 's:test_plot:_&:' \
- -i nltk/test/unit/test_cfd_mutation.py || die
distutils-r1_src_prepare
}