Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
tests:
Expand Down Expand Up @@ -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

Expand All @@ -52,7 +53,7 @@ jobs:

- name: Test with pytest
run: |
pytest --dist=loadfile -n auto
pytest

lint:
name: Lint with Ruff
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
10 changes: 1 addition & 9 deletions tests/test_api_public.py
Original file line number Diff line number Diff line change
@@ -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:
"""
Expand All @@ -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.")
3 changes: 0 additions & 3 deletions tests/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down