diff --git a/pyproject.toml b/pyproject.toml index 14c27deb..1f2c122e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,7 +121,7 @@ PYDEVD_DISABLE_FILE_VALIDATION = "1" # Uses PYTEST_MARKERS env var for default markers # For custom markers, one can either adjust the env var or just use -m option in the command line, # as the second -m option will override the first one. -test = "pytest test -vv -m \"${PYTEST_MARKERS:-not java and not rust and not erlang}\"" +test = "pytest test -vv -m \"${PYTEST_MARKERS:-not rust and not erlang}\"" _black_check = "black --check src scripts test" _ruff_check = "ruff check src scripts test" _black_format = "black src scripts test" diff --git a/test/solidlsp/java/test_java_basic.py b/test/solidlsp/java/test_java_basic.py index 0b081695..5b3bcd6a 100644 --- a/test/solidlsp/java/test_java_basic.py +++ b/test/solidlsp/java/test_java_basic.py @@ -1,4 +1,5 @@ import os +import platform import pytest @@ -6,8 +7,13 @@ from solidlsp import SolidLanguageServer from solidlsp.ls_config import Language from solidlsp.ls_utils import SymbolUtils +# These marks will be applied to all tests in this module. +# We skip the tests if not on Windows (CI hangs on Ubuntu for unknown reasons; testing on Windows is sufficient) +is_ci = os.getenv("CI") == "true" or os.getenv("GITHUB_ACTIONS") == "true" +java_tests_enabled = not is_ci or platform.system() == "Windows" +pytestmark = [pytest.mark.java, pytest.mark.skipif(not java_tests_enabled, reason="Java tests are only run on Windows in CI")] + -@pytest.mark.java class TestJavaLanguageServer: @pytest.mark.parametrize("language_server", [Language.JAVA], indirect=True) def test_find_symbol(self, language_server: SolidLanguageServer) -> None: