Skip to content

Commit 0d3d480

Browse files
committed
Add more unit test checks
Signed-off-by: lelia <lelia@socket.dev>
1 parent 9ab5b87 commit 0d3d480

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/unit/test_config.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
from pathlib import Path
12
import pytest
23
from unittest.mock import patch
4+
import tomllib
35
from socketsecurity.core.socket_config import SocketConfig
46
from socketsecurity.config import CliConfig
57

@@ -162,3 +164,16 @@ def test_config_file_json_sets_defaults(self, tmp_path):
162164
assert config.sarif_scope == "full"
163165
assert config.sarif_grouping == "alert"
164166
assert config.sarif_reachability == "reachable"
167+
168+
169+
def test_pyproject_requires_python_matches_tomllib_usage():
170+
pyproject = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
171+
requires_python = pyproject["project"]["requires-python"]
172+
173+
assert requires_python.startswith(">=")
174+
175+
minimum_version = tuple(int(part) for part in requires_python.removeprefix(">=").split(".")[:2])
176+
config_module = Path("socketsecurity/config.py").read_text(encoding="utf-8")
177+
178+
if "import tomllib" in config_module:
179+
assert minimum_version >= (3, 11)

0 commit comments

Comments
 (0)