commit cb151aa006940031b7e984f8d610d11210f868a7 Author: Lokendra Singh Date: Tue Aug 13 12:01:18 2019 +0530 Tests for subprocess implementation (#63) * tests for subprocess implementation * fix: code coverage * update travis removed: python setup.py test * added: subprocess test for tagger diff --git a/.travis.yml b/.travis.yml index dc0ae16..4dc68d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ install: before_script: - ./build-swig-wrapper.sh script: - - python3 setup.py test - flake8 --verbose apertium - if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then mypy apertium --strict --any-exprs-report .mypy_coverage --ignore-missing-imports; diff --git a/apertium/__init__.py b/apertium/__init__.py index 061ffb3..41620e8 100644 --- a/apertium/__init__.py +++ b/apertium/__init__.py @@ -9,6 +9,7 @@ from apertium.installer import install_module # noqa: F401 from apertium.mode_search import search_path from apertium.tagger import tag, Tagger # noqa: F401 from apertium.translation import translate, Translator # noqa: F401 +from apertium.utils import wrappers_available # noqa: F401 class ModeNotInstalled(ValueError): diff --git a/tests/__init__.py b/tests/__init__.py index c4f47a6..3ea98fe 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -99,6 +99,40 @@ class TestInstallation(unittest.TestCase): self.assertIsNotNone(importlib.util.find_spec('lttoolbox'), 'Wrapper not installed') +class TestSubProcess(unittest.TestCase): + def test_analyze_en_subprocess(self): + apertium.utils.wrappers_available = False + test_analyze = TestAnalyze() + test_analyze.test_analyzer_en() + test_analyze.test_analyze_en() + apertium.utils.wrappers_available = True + + def test_generate_en_subprocess(self): + apertium.utils.wrappers_available = False + test_generate = TestGenerate() + test_generate.test_generator_single() + test_generate.test_generator_multiple() + test_generate.test_generator_bare() + test_generate.test_single() + test_generate.test_multiple() + test_generate.test_bare() + apertium.utils.wrappers_available = True + + def test_translate_en_es_subprocess(self): + apertium.utils.wrappers_available = False + test_translate = TestTranslate() + test_translate.test_translator_en_spa() + test_translate.test_en_spa() + apertium.utils.wrappers_available = True + + def test_tagger_en_subprocess(self): + apertium.utils.wrappers_available = False + test_tagger = TestTagger() + test_tagger.test_tagger_en() + test_tagger.test_tag_en() + apertium.utils.wrappers_available = True + + class TestTranslate(unittest.TestCase): @unittest.skipIf(platform.system() == 'Windows', 'lrx-proc -m bug #25') def test_translator_en_spa(self):