[tests] skip TokenizerTest and FilterTests when NLTK is not installed
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Sun, 23 Nov 2014 19:02:07 +0100
changeset 483 57db633dd297
parent 482 2cf6218df07a
child 484 36e8adaa0b18
[tests] skip TokenizerTest and FilterTests when NLTK is not installed
test/test_filters.py
test/test_tokenizer.py
--- a/test/test_filters.py	Sun Nov 23 18:59:29 2014 +0100
+++ b/test/test_filters.py	Sun Nov 23 19:02:07 2014 +0100
@@ -27,9 +27,10 @@
                                NerReplacementRulesFilter,
                                NerDisambiguationWordParts)
 from nazca.ner.sources import NerSourceLexicon
-from nazca.utils.tokenizer import Token, Sentence
+from nazca.utils.tokenizer import Token, Sentence, NLTK_AVAILABLE
 
 
+@unittest.skipUnless(NLTK_AVAILABLE, 'nltk is not available')
 class FilterTest(unittest.TestCase):
     """ Test of filters """
 
--- a/test/test_tokenizer.py	Sun Nov 23 18:59:29 2014 +0100
+++ b/test/test_tokenizer.py	Sun Nov 23 19:02:07 2014 +0100
@@ -22,9 +22,11 @@
 else:
     import unittest2 as unittest
 
-from nazca.utils.tokenizer import RichStringTokenizer, Token, Sentence
+from nazca.utils.tokenizer import (RichStringTokenizer, Token,
+                                   Sentence, NLTK_AVAILABLE)
 
 
+@unittest.skipUnless(NLTK_AVAILABLE, 'nltk is not available')
 class TokenizerTest(unittest.TestCase):
     """ Test of tokenizer """