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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mss = "mss.__main__:main"
dev = [
"build==1.3.0",
"mypy==1.17.1",
"ruff==0.11.11",
"ruff==0.12.9",
"twine==6.1.0",
]
docs = [
Expand Down
6 changes: 3 additions & 3 deletions src/mss/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ def mss(**kwargs: Any) -> MSSBase:
os_ = platform.system().lower()

if os_ == "darwin":
from mss import darwin
from mss import darwin # noqa: PLC0415

return darwin.MSS(**kwargs)

if os_ == "linux":
from mss import linux
from mss import linux # noqa: PLC0415

return linux.MSS(**kwargs)

if os_ == "windows":
from mss import windows
from mss import windows # noqa: PLC0415

return windows.MSS(**kwargs)

Expand Down
6 changes: 2 additions & 4 deletions src/tests/test_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from __future__ import annotations

import os
import os.path
import platform
import sys
import threading
import time
from datetime import datetime
from pathlib import Path
from typing import TYPE_CHECKING
Expand All @@ -16,7 +17,6 @@
import pytest

import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exception import ScreenShotError
Expand Down Expand Up @@ -237,8 +237,6 @@ def test_grab_with_tuple_percents() -> None:

def test_thread_safety() -> None:
"""Regression test for issue #169."""
import threading
import time

def record(check: dict) -> None:
"""Record for one second."""
Expand Down
6 changes: 2 additions & 4 deletions src/tests/test_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
Source: https://github.com/BoboTiG/python-mss.
"""

import ctypes
import os
import platform
import subprocess
from collections.abc import Callable

import pytest
Expand All @@ -18,8 +20,6 @@ def get_opened_socket() -> int:
"""GNU/Linux: a way to get the opened sockets count.
It will be used to check X server connections are well closed.
"""
import subprocess

cmd = f"lsof -U | grep {PID}"
output = subprocess.check_output(cmd, shell=True)
return len(output.splitlines())
Expand All @@ -29,8 +29,6 @@ def get_handles() -> int:
"""Windows: a way to get the GDI handles count.
It will be used to check the handles count is not growing, showing resource leaks.
"""
import ctypes

PROCESS_QUERY_INFORMATION = 0x400 # noqa:N806
GR_GDIOBJECTS = 0 # noqa:N806
h = ctypes.windll.kernel32.OpenProcess(PROCESS_QUERY_INFORMATION, 0, PID)
Expand Down
6 changes: 3 additions & 3 deletions src/tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
pytest.importorskip("build")
pytest.importorskip("twine")

SDIST = "python -m build --sdist".split()
WHEEL = "python -m build --wheel".split()
CHECK = "twine check --strict".split()
SDIST = ["python", "-m", "build", "--sdist"]
WHEEL = ["python", "-m", "build", "--wheel"]
CHECK = ["twine", "check", "--strict"]


def test_sdist() -> None:
Expand Down
Loading