diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index adb23cc..71b50d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,7 @@ on: branches: [ master ] pull_request: branches: [ master ] + workflow_dispatch: jobs: tests: @@ -38,7 +39,7 @@ jobs: - name: Install dependencies & build package run: | - uv pip install setuptools wheel build pytest pytest-cov pytest-rerunfailures pytest-xdist --system + uv pip install setuptools wheel build pytest pytest-cov --system uv build uv pip install dist/*.whl --system @@ -52,7 +53,7 @@ jobs: - name: Test with pytest run: | - pytest --dist=loadfile -n auto + pytest lint: name: Lint with Ruff diff --git a/pyproject.toml b/pyproject.toml index 94d4df0..dd965d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,10 +42,7 @@ changelog = "https://github.com/jxmorris12/language_tool_python/blob/master/CHAN [dependency-groups] tests = [ "pytest", - "pytest-xdist", "pytest-cov", - "pytest-rerunfailures", - "pytest-runner" ] docs = [ diff --git a/tests/test_api_public.py b/tests/test_api_public.py index 6e9a734..73ebd75 100644 --- a/tests/test_api_public.py +++ b/tests/test_api_public.py @@ -1,16 +1,9 @@ """Tests for the public API functionality.""" -import os - import pytest from language_tool_python.exceptions import RateLimitError -pytestmark = pytest.mark.skipif( - os.getenv("GITHUB_ACTIONS") == "true", - reason="Skip public API test on CI (depends on external service).", -) - def test_remote_es() -> None: """ @@ -31,5 +24,4 @@ def test_remote_es() -> None: == """[Match({'rule_id': 'AFRENTAR_DIFICULTADES', 'message': 'Confusión entre «afrontar» y «afrentar».', 'replacements': ['afrontar'], 'offset_in_context': 43, 'context': '...n texto aquí. LanguageTool le ayudará a afrentar algunas dificultades propias de la escr...', 'offset': 49, 'error_length': 8, 'category': 'INCORRECT_EXPRESSIONS', 'rule_issue_type': 'grammar', 'sentence': 'LanguageTool le ayudará a afrentar algunas dificultades propias de la escritura.'}), Match({'rule_id': 'PRON_HABER_PARTICIPIO', 'message': 'El v. ‘haber’ se escribe con hache.', 'replacements': ['ha'], 'offset_in_context': 43, 'context': '...ificultades propias de la escritura. Se a hecho un esfuerzo para detectar errores...', 'offset': 107, 'error_length': 1, 'category': 'MISSPELLING', 'rule_issue_type': 'misspelling', 'sentence': 'Se a hecho un esfuerzo para detectar errores tipográficos, ortograficos y incluso gramaticales.'}), Match({'rule_id': 'MORFOLOGIK_RULE_ES', 'message': 'Se ha encontrado un posible error ortográfico.', 'replacements': ['ortográficos', 'ortográficas', 'ortográfico', 'orográficos', 'ortografiaos', 'ortografíeos'], 'offset_in_context': 43, 'context': '...rzo para detectar errores tipográficos, ortograficos y incluso gramaticales. También algunos...', 'offset': 163, 'error_length': 12, 'category': 'TYPOS', 'rule_issue_type': 'misspelling', 'sentence': 'Se a hecho un esfuerzo para detectar errores tipográficos, ortograficos y incluso gramaticales.'}), Match({'rule_id': 'Y_E_O_U', 'message': 'Cuando precede a palabras que comienzan por ‘i’, la conjunción ‘y’ se transforma en ‘e’.', 'replacements': ['e'], 'offset_in_context': 43, 'context': '...ctar errores tipográficos, ortograficos y incluso gramaticales. También algunos e...', 'offset': 176, 'error_length': 1, 'category': 'GRAMMAR', 'rule_issue_type': 'grammar', 'sentence': 'Se a hecho un esfuerzo para detectar errores tipográficos, ortograficos y incluso gramaticales.'}), Match({'rule_id': 'GROSSO_MODO', 'message': 'Esta expresión latina se usa sin preposición.', 'replacements': ['grosso modo'], 'offset_in_context': 43, 'context': '...les. También algunos errores de estilo, a grosso modo.', 'offset': 235, 'error_length': 13, 'category': 'GRAMMAR', 'rule_issue_type': 'grammar', 'sentence': 'También algunos errores de estilo, a grosso modo.'})]""" ) except RateLimitError: - print("Rate limit error: skipping test about public API.") - return + pytest.skip("Rate limit exceeded for public API.") diff --git a/tests/test_match.py b/tests/test_match.py index 2f1503d..cd7f46d 100644 --- a/tests/test_match.py +++ b/tests/test_match.py @@ -2,10 +2,7 @@ from typing import Any, Dict, List -import pytest - -@pytest.mark.flaky(reruns=2) # type: ignore[misc] # Sometimes LT throws NoClassDefFoundError (500) def test_langtool_load() -> None: """ Test the basic functionality of LanguageTool and Match object attributes.