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
36 changes: 36 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Workflow to run pytest
name: pytest

on: [push, pull_request]

permissions:
contents: read

env:
UV_SYSTEM_PYTHON: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1

jobs:
pytest:
name: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@22695119d769bdb6f7032ad67b9bca0ef8c4a174 # v5.4.0
with:
enable-cache: true
cache-dependency-glob: ''
cache-suffix: '3.13'
- name: Setup Python
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
with:
python-version: '3.13'
- name: Install OS dependencies
run: |
sudo apt-get update -yy
sudo apt-get install -yy --no-install-recommends libcairo2-dev libgirepository-2.0-dev gir1.2-gtk-4.0
- run: uv pip install -r pyproject.toml
- run: uv pip install --group tests
- run: pytest
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ include README.md

graft safeeyes

prune safeeyes/tests

global-exclude *.py[cod]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ To ensure that the coding and formatting guidelines are followed, install [ruff]

To ensure that any types are correct, install [mypy](https://github.com/python/mypy) and run `mypy safeeyes`.

The last three checks are also run in CI, so a PR must pass all the tests for it to be mmerged.
To ensure that the tests still pass, install [pytest](https://docs.pytest.org/en/stable/) and run `pytest`.

The last four checks are also run in CI, so a PR must pass all the tests for it to be mmerged.

It is also possible to use dependency groups to install the needed dependencies. When using a new enough version of pip, run `pip install --group types` to install all dependencies to run the type check.
The available dependency groups can be found in the `pyproject.toml` file.

## How to Release?

Expand Down
15 changes: 13 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
include=["safeeyes*"]
exclude=["safeeyes.tests*"]

[dependency-groups]
dev = [
{include-group = "lint"},
{include-group = "scripts"},
{include-group = "types"}
{include-group = "tests"},
{include-group = "types"},
]
lint = [
"ruff==0.11.2"
Expand All @@ -64,7 +66,11 @@ types = [
"PyGObject-stubs==2.13.0",
"types-croniter==5.0.1.20250322",
"types-psutil==7.0.0.20250218",
"types-python-xlib==0.33.0.20240407"
"types-python-xlib==0.33.0.20240407",
{include-group = "tests"},
]
tests = [
"pytest==8.3.5",
]

[tool.mypy]
Expand All @@ -78,3 +84,8 @@ enable_error_code = [
"ignore-without-code",
"possibly-undefined"
]

[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
]
4 changes: 1 addition & 3 deletions safeeyes/plugins/smartpause/dependency_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

def validate(plugin_config, plugin_settings):
command = None
if utility.DESKTOP_ENVIRONMENT == "gnome" and utility.IS_WAYLAND:
command = "dbus-send"
elif utility.DESKTOP_ENVIRONMENT == "sway":
if utility.DESKTOP_ENVIRONMENT == "sway":
command = "swayidle"
elif utility.IS_WAYLAND:
if not utility.module_exist("pywayland"):
Expand Down
Loading
Loading