mirror of
				https://github.com/TheAnachronism/docspell.git
				synced 2025-10-31 09:30:12 +00:00 
			
		
		
		
	Disable memory intensive tests on travis
This commit is contained in:
		
							
								
								
									
										12
									
								
								modules/analysis/src/test/scala/docspell/analysis/Env.scala
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								modules/analysis/src/test/scala/docspell/analysis/Env.scala
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| package docspell.analysis | ||||
|  | ||||
| object Env { | ||||
|  | ||||
|   def isCI = bool("CI") | ||||
|  | ||||
|   def bool(key: String): Boolean = | ||||
|     string(key).contains("true") | ||||
|  | ||||
|   def string(key: String): Option[String] = | ||||
|     Option(System.getenv(key)).filter(_.nonEmpty) | ||||
| } | ||||
| @@ -1,5 +1,6 @@ | ||||
| package docspell.analysis.nlp | ||||
|  | ||||
| import docspell.analysis.Env | ||||
| import docspell.common.Language.NLPLanguage | ||||
| import minitest.SimpleTestSuite | ||||
| import docspell.files.TestFiles | ||||
| @@ -11,6 +12,10 @@ object BaseCRFAnnotatorSuite extends SimpleTestSuite { | ||||
|     BasicCRFAnnotator.nerAnnotate(BasicCRFAnnotator.Cache.getAnnotator(language)) | ||||
|  | ||||
|   test("find english ner labels") { | ||||
|     if (Env.isCI) { | ||||
|       ignore("Test ignored on travis.") | ||||
|     } | ||||
|  | ||||
|     val labels = annotate(Language.English)(TestFiles.letterENText) | ||||
|     val expect = Vector( | ||||
|       NerLabel("Derek", NerTag.Person, 0, 5), | ||||
| @@ -47,6 +52,10 @@ object BaseCRFAnnotatorSuite extends SimpleTestSuite { | ||||
|   } | ||||
|  | ||||
|   test("find german ner labels") { | ||||
|     if (Env.isCI) { | ||||
|       ignore("Test ignored on travis.") | ||||
|     } | ||||
|  | ||||
|     val labels = annotate(Language.German)(TestFiles.letterDEText) | ||||
|     val expect = Vector( | ||||
|       NerLabel("Max", NerTag.Person, 0, 3), | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package docspell.analysis.nlp | ||||
| import java.nio.file.Paths | ||||
|  | ||||
| import cats.effect.IO | ||||
| import docspell.analysis.Env | ||||
| import minitest.SimpleTestSuite | ||||
| import docspell.files.TestFiles | ||||
| import docspell.common._ | ||||
| @@ -16,6 +17,10 @@ object StanfordNerAnnotatorSuite extends SimpleTestSuite { | ||||
|     new StanfordCoreNLP(Properties.nerEnglish(None)) | ||||
|  | ||||
|   test("find english ner labels") { | ||||
|     if (Env.isCI) { | ||||
|       ignore("Test ignored on travis.") | ||||
|     } | ||||
|  | ||||
|     val labels = | ||||
|       StanfordNerAnnotator.nerAnnotate(englishClassifier, TestFiles.letterENText) | ||||
|     val expect = Vector( | ||||
| @@ -53,6 +58,10 @@ object StanfordNerAnnotatorSuite extends SimpleTestSuite { | ||||
|   } | ||||
|  | ||||
|   test("find german ner labels") { | ||||
|     if (Env.isCI) { | ||||
|       ignore("Test ignored on travis.") | ||||
|     } | ||||
|  | ||||
|     val labels = | ||||
|       StanfordNerAnnotator.nerAnnotate(germanClassifier, TestFiles.letterDEText) | ||||
|     val expect = Vector( | ||||
| @@ -74,6 +83,10 @@ object StanfordNerAnnotatorSuite extends SimpleTestSuite { | ||||
|   } | ||||
|  | ||||
|   test("regexner-only annotator") { | ||||
|     if (Env.isCI) { | ||||
|       ignore("Test ignored on travis.") | ||||
|     } | ||||
|  | ||||
|     val regexNerContent = | ||||
|       s"""(?i)volantino ag${"\t"}ORGANIZATION${"\t"}LOCATION,PERSON,MISC${"\t"}3 | ||||
|       |(?i)volantino${"\t"}ORGANIZATION${"\t"}LOCATION,PERSON,MISC${"\t"}3 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user