chore: add tests, update docs and actions (#299)

* docs: update documentation

* feat: validate-inputs has it's own pyproject

* security: mask DOCKERHUB_PASSWORD

* chore: add tokens, checkout, recrete docs, integration tests

* fix: add `statuses: write` permission to pr-lint
This commit is contained in:
2025-10-18 13:09:19 +03:00
committed by GitHub
parent d3c2de1bd1
commit 7061aafd35
148 changed files with 5119 additions and 1897 deletions

View File

@@ -2,9 +2,9 @@
from __future__ import annotations
from pathlib import Path
import sys
import unittest
from pathlib import Path
from unittest.mock import patch
# Add parent directory to path

View File

@@ -1,16 +1,15 @@
"""Tests for the BooleanValidator module."""
from pathlib import Path
import sys
from pathlib import Path
import pytest # pylint: disable=import-error
# Add the parent directory to the path
sys.path.insert(0, str(Path(__file__).parent.parent))
from validators.boolean import BooleanValidator
from tests.fixtures.version_test_data import BOOLEAN_INVALID, BOOLEAN_VALID
from validators.boolean import BooleanValidator
class TestBooleanValidator:

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "codeql-analysis"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "common-cache"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "common-file-check"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "common-retry"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "compress-images"

View File

@@ -1,7 +1,7 @@
"""Tests for the ConventionMapper class."""
from pathlib import Path
import sys
from pathlib import Path
# Add the parent directory to the path
sys.path.insert(0, str(Path(__file__).parent.parent))

View File

@@ -1,7 +1,7 @@
"""Tests for custom validators in action directories."""
from pathlib import Path
import sys
from pathlib import Path
# Add parent directory to path
sys.path.insert(0, str(Path(__file__).parent.parent))

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "docker-build"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "docker-publish-gh"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "docker-publish-hub"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "docker-publish"

View File

@@ -1,7 +1,7 @@
"""Tests for the DockerValidator module."""
from pathlib import Path
import sys
from pathlib import Path
# Add the parent directory to the path
sys.path.insert(0, str(Path(__file__).parent.parent))

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "eslint-check"

View File

@@ -1,16 +1,15 @@
"""Tests for the FileValidator module."""
from pathlib import Path
import sys
from pathlib import Path
import pytest # pylint: disable=import-error
# Add the parent directory to the path
sys.path.insert(0, str(Path(__file__).parent.parent))
from validators.file import FileValidator
from tests.fixtures.version_test_data import FILE_PATH_INVALID, FILE_PATH_VALID
from validators.file import FileValidator
class TestFileValidator:

View File

@@ -2,9 +2,9 @@
# pylint: disable=protected-access # Testing private methods is intentional
import importlib.util
from pathlib import Path
import sys
import tempfile
from pathlib import Path
import yaml # pylint: disable=import-error

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "go-lint"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "go-version-detect"

View File

@@ -1,10 +1,10 @@
"""Integration tests for the validator script execution."""
import os
from pathlib import Path
import subprocess
import sys
import tempfile
from pathlib import Path
import pytest # pylint: disable=import-error
@@ -20,7 +20,8 @@ class TestValidatorIntegration:
del os.environ[key]
# Create temporary output file
self.temp_output = tempfile.NamedTemporaryFile(mode="w", delete=False)
# noqa: SIM115 - Need persistent file for teardown, can't use context manager
self.temp_output = tempfile.NamedTemporaryFile(mode="w", delete=False) # noqa: SIM115
os.environ["GITHUB_OUTPUT"] = self.temp_output.name
self.temp_output.close()

View File

@@ -3,8 +3,8 @@
from __future__ import annotations
import os
from pathlib import Path
import sys
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest # pylint: disable=import-error
@@ -24,14 +24,11 @@ class TestModularValidator:
output_file = tmp_path / "github_output"
output_file.touch()
with (
patch.dict(
os.environ,
{"GITHUB_OUTPUT": str(output_file)},
clear=True,
),
pytest.raises(SystemExit) as exc_info,
):
with patch.dict(
os.environ,
{"GITHUB_OUTPUT": str(output_file)},
clear=True,
), pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 1
@@ -45,19 +42,16 @@ class TestModularValidator:
output_file.touch()
# docker-build is a known action with a validator
with (
patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
"INPUT_TAG": "v1.0.0",
"INPUT_IMAGE_NAME": "myapp",
},
clear=True,
),
patch("modular_validator.logger") as mock_logger,
):
with patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
"INPUT_TAG": "v1.0.0",
"INPUT_IMAGE_NAME": "myapp",
},
clear=True,
), patch("modular_validator.logger") as mock_logger:
main()
content = output_file.read_text()
@@ -69,20 +63,18 @@ class TestModularValidator:
output_file = tmp_path / "github_output"
output_file.touch()
with (
patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
"INPUT_TAG": "invalid_tag!", # Invalid tag format
},
clear=True,
),
patch("modular_validator.logger") as mock_logger,
pytest.raises(SystemExit) as exc_info,
with patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
"INPUT_TAG": "invalid_tag!", # Invalid tag format
},
clear=True,
):
main()
with patch("modular_validator.logger") as mock_logger:
with pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 1
content = output_file.read_text()
@@ -99,21 +91,18 @@ class TestModularValidator:
mock_validator.validate_inputs.return_value = True
mock_validator.errors = []
with (
patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
"INPUT_TAG": "v1.0.0",
"INPUT_IMAGE_NAME": "myapp",
"INPUT_BUILD_ARGS": "NODE_ENV=prod",
"NOT_AN_INPUT": "should_be_ignored",
},
clear=True,
),
patch("modular_validator.get_validator", return_value=mock_validator),
):
with patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
"INPUT_TAG": "v1.0.0",
"INPUT_IMAGE_NAME": "myapp",
"INPUT_BUILD_ARGS": "NODE_ENV=prod",
"NOT_AN_INPUT": "should_be_ignored",
},
clear=True,
), patch("modular_validator.get_validator", return_value=mock_validator):
main()
# Check that validate_inputs was called with correct inputs
@@ -133,18 +122,15 @@ class TestModularValidator:
mock_validator.validate_inputs.return_value = True
mock_validator.errors = []
with (
patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
"INPUT_BUILD_ARGS": "test=value",
},
clear=True,
),
patch("modular_validator.get_validator", return_value=mock_validator),
):
with patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
"INPUT_BUILD_ARGS": "test=value",
},
clear=True,
), patch("modular_validator.get_validator", return_value=mock_validator):
main()
# Check that both underscore and dash versions are present
@@ -160,17 +146,14 @@ class TestModularValidator:
mock_validator.validate_inputs.return_value = True
mock_validator.errors = []
with (
patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
},
clear=True,
),
patch("modular_validator.get_validator", return_value=mock_validator) as mock_get,
):
with patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
},
clear=True,
), patch("modular_validator.get_validator", return_value=mock_validator) as mock_get:
main()
# get_validator should be called with underscore version
@@ -181,19 +164,16 @@ class TestModularValidator:
output_file = tmp_path / "github_output"
output_file.touch()
with (
patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
},
clear=True,
),
patch("modular_validator.get_validator", side_effect=ValueError("Test error")),
pytest.raises(SystemExit) as exc_info,
):
main()
with patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
},
clear=True,
), patch("modular_validator.get_validator", side_effect=ValueError("Test error")):
with pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 1
content = output_file.read_text()
@@ -206,13 +186,11 @@ class TestModularValidator:
fallback_path = Path.home() / "github_output"
try:
with (
patch.dict(os.environ, {"INPUT_ACTION_TYPE": "docker-build"}, clear=True),
patch("modular_validator.get_validator", side_effect=ValueError("Test error")),
patch("modular_validator.logger"),
pytest.raises(SystemExit) as exc_info,
):
main()
with patch.dict(os.environ, {"INPUT_ACTION_TYPE": "docker-build"}, clear=True):
with patch("modular_validator.get_validator", side_effect=ValueError("Test error")):
with patch("modular_validator.logger"):
with pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 1
@@ -235,19 +213,16 @@ class TestModularValidator:
mock_validator.validate_inputs.return_value = False
mock_validator.errors = ["Error 1", "Error 2"]
with (
patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
},
clear=True,
),
patch("modular_validator.get_validator", return_value=mock_validator),
pytest.raises(SystemExit) as exc_info,
):
main()
with patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": "docker-build",
},
clear=True,
), patch("modular_validator.get_validator", return_value=mock_validator):
with pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 1
content = output_file.read_text()
@@ -260,18 +235,16 @@ class TestModularValidator:
output_file = tmp_path / "github_output"
output_file.touch()
with (
patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": " ", # Whitespace only
},
clear=True,
),
pytest.raises(SystemExit) as exc_info,
with patch.dict(
os.environ,
{
"GITHUB_OUTPUT": str(output_file),
"INPUT_ACTION_TYPE": " ", # Whitespace only
},
clear=True,
):
main()
with pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 1
content = output_file.read_text()

View File

@@ -1,21 +1,20 @@
"""Tests for the NetworkValidator module."""
from pathlib import Path
import sys
from pathlib import Path
import pytest # pylint: disable=import-error
# Add the parent directory to the path
sys.path.insert(0, str(Path(__file__).parent.parent))
from validators.network import NetworkValidator
from tests.fixtures.version_test_data import (
EMAIL_INVALID,
EMAIL_VALID,
USERNAME_INVALID,
USERNAME_VALID,
)
from validators.network import NetworkValidator
class TestNetworkValidator:

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "node-setup"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "npm-publish"

View File

@@ -1,7 +1,7 @@
"""Tests for the NumericValidator module."""
from pathlib import Path
import sys
from pathlib import Path
import pytest # pylint: disable=import-error
@@ -9,9 +9,8 @@ import pytest # pylint: disable=import-error
sys.path.insert(0, str(Path(__file__).parent.parent))
# pylint: disable=wrong-import-position
from validators.numeric import NumericValidator
from tests.fixtures.version_test_data import NUMERIC_RANGE_INVALID, NUMERIC_RANGE_VALID
from validators.numeric import NumericValidator
class TestNumericValidator:

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "php-composer"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "php-laravel-phpunit"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "php-tests"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "php-version-detect"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "pre-commit"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "prettier-check"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "prettier-fix"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "python-lint-fix"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "python-version-detect-v2"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "python-version-detect"

View File

@@ -2,10 +2,10 @@
from __future__ import annotations
from pathlib import Path
import sys
import tempfile
import unittest
from pathlib import Path
from unittest.mock import MagicMock, patch
# Add parent directory to path

View File

@@ -1,7 +1,7 @@
"""Tests for the SecurityValidator module."""
from pathlib import Path
import sys
from pathlib import Path
# Add the parent directory to the path
sys.path.insert(0, str(Path(__file__).parent.parent))

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "set-git-config"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "sync-labels"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "terraform-lint-fix"

View File

@@ -1,7 +1,7 @@
"""Tests for the TokenValidator module."""
from pathlib import Path
import sys
from pathlib import Path
import pytest # pylint: disable=import-error
@@ -9,9 +9,8 @@ import pytest # pylint: disable=import-error
sys.path.insert(0, str(Path(__file__).parent.parent))
# pylint: disable=wrong-import-position
from validators.token import TokenValidator
from tests.fixtures.version_test_data import GITHUB_TOKEN_INVALID, GITHUB_TOKEN_VALID
from validators.token import TokenValidator
class TestTokenValidator:

View File

@@ -2,9 +2,9 @@
import argparse
import importlib.util
from pathlib import Path
import sys
import tempfile
from pathlib import Path
from unittest.mock import patch
import yaml # pylint: disable=import-error
@@ -440,13 +440,10 @@ class TestCLIFunctionality:
"""Test main function with --dry-run flag."""
test_args = ["update-validators.py", "--dry-run"]
with (
patch("sys.argv", test_args),
patch.object(
ValidationRuleGenerator,
"generate_rules",
) as mock_generate,
):
with patch("sys.argv", test_args), patch.object(
ValidationRuleGenerator,
"generate_rules",
) as mock_generate:
main()
mock_generate.assert_called_once()
@@ -454,13 +451,10 @@ class TestCLIFunctionality:
"""Test main function with --action flag."""
test_args = ["update-validators.py", "--action", "test-action"]
with (
patch("sys.argv", test_args),
patch.object(
ValidationRuleGenerator,
"generate_rules",
) as mock_generate,
):
with patch("sys.argv", test_args), patch.object(
ValidationRuleGenerator,
"generate_rules",
) as mock_generate:
main()
mock_generate.assert_called_once()
@@ -468,15 +462,11 @@ class TestCLIFunctionality:
"""Test main function with --validate flag (success case)."""
test_args = ["update-validators.py", "--validate"]
with (
patch("sys.argv", test_args),
patch.object(
ValidationRuleGenerator,
"validate_rules_files",
return_value=True,
),
patch("sys.exit") as mock_exit,
):
with patch("sys.argv", test_args), patch.object(
ValidationRuleGenerator,
"validate_rules_files",
return_value=True,
), patch("sys.exit") as mock_exit:
main()
mock_exit.assert_called_once_with(0)
@@ -484,15 +474,11 @@ class TestCLIFunctionality:
"""Test main function with --validate flag (failure case)."""
test_args = ["update-validators.py", "--validate"]
with (
patch("sys.argv", test_args),
patch.object(
ValidationRuleGenerator,
"validate_rules_files",
return_value=False,
),
patch("sys.exit") as mock_exit,
):
with patch("sys.argv", test_args), patch.object(
ValidationRuleGenerator,
"validate_rules_files",
return_value=False,
), patch("sys.exit") as mock_exit:
main()
mock_exit.assert_called_once_with(1)

View File

@@ -1,8 +1,8 @@
"""Tests for validate-inputs custom validator."""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "validate-inputs"

View File

@@ -1,9 +1,9 @@
"""Tests for the main validator entry point."""
import os
from pathlib import Path
import sys
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest # pylint: disable=import-error
@@ -23,7 +23,8 @@ class TestValidatorScript:
del os.environ[key]
# Create temporary output file
self.temp_output = tempfile.NamedTemporaryFile(mode="w", delete=False)
# Need persistent file for teardown, can't use context manager
self.temp_output = tempfile.NamedTemporaryFile(mode="w", delete=False) # noqa: SIM115
os.environ["GITHUB_OUTPUT"] = self.temp_output.name
self.temp_output.close()
@@ -181,7 +182,8 @@ class TestValidatorIntegration:
def setup_method(self):
"""Set up test environment."""
self.temp_output = tempfile.NamedTemporaryFile(mode="w", delete=False)
# Need persistent file for teardown, can't use context manager
self.temp_output = tempfile.NamedTemporaryFile(mode="w", delete=False) # noqa: SIM115
os.environ["GITHUB_OUTPUT"] = self.temp_output.name
self.temp_output.close()

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "version-file-parser"

View File

@@ -4,8 +4,8 @@ Generated by generate-tests.py - Do not edit manually.
"""
# pylint: disable=invalid-name # Test file name matches action name
from pathlib import Path
import sys
from pathlib import Path
# Add action directory to path to import custom validator
action_path = Path(__file__).parent.parent.parent / "version-validator"

View File

@@ -1,7 +1,7 @@
"""Tests for the VersionValidator module."""
from pathlib import Path
import sys
from pathlib import Path
import pytest # pylint: disable=import-error
@@ -9,14 +9,13 @@ import pytest # pylint: disable=import-error
sys.path.insert(0, str(Path(__file__).parent.parent))
# pylint: disable=wrong-import-position
from validators.version import VersionValidator
from tests.fixtures.version_test_data import (
CALVER_INVALID,
CALVER_VALID,
SEMVER_INVALID,
SEMVER_VALID,
)
from validators.version import VersionValidator
class TestVersionValidator: # pylint: disable=too-many-public-methods