Skip to content

Commit 033ea9e

Browse files
authored
Merge pull request slgobinath#733 from deltragon/pytest-breakqueue
pytest: add tests for Break and BreakQueue
2 parents 396b18c + 180fc43 commit 033ea9e

File tree

6 files changed

+407
-3
lines changed

6 files changed

+407
-3
lines changed

.github/workflows/pytest.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Workflow to run pytest
2+
name: pytest
3+
4+
on: [push, pull_request]
5+
6+
permissions:
7+
contents: read
8+
9+
env:
10+
UV_SYSTEM_PYTHON: 1
11+
PIP_DISABLE_PIP_VERSION_CHECK: 1
12+
13+
jobs:
14+
pytest:
15+
name: pytest
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
persist-credentials: false
21+
- uses: astral-sh/setup-uv@22695119d769bdb6f7032ad67b9bca0ef8c4a174 # v5.4.0
22+
with:
23+
enable-cache: true
24+
cache-dependency-glob: ''
25+
cache-suffix: '3.13'
26+
- name: Setup Python
27+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
28+
with:
29+
python-version: '3.13'
30+
- name: Install OS dependencies
31+
run: |
32+
sudo apt-get update -yy
33+
sudo apt-get install -yy --no-install-recommends libcairo2-dev libgirepository-2.0-dev gir1.2-gtk-4.0
34+
- run: uv pip install -r pyproject.toml
35+
- run: uv pip install --group tests
36+
- run: pytest

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ include README.md
33

44
graft safeeyes
55

6+
prune safeeyes/tests
7+
68
global-exclude *.py[cod]

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ To ensure that the coding and formatting guidelines are followed, install [ruff]
211211

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

214-
The last three checks are also run in CI, so a PR must pass all the tests for it to be mmerged.
214+
To ensure that the tests still pass, install [pytest](https://docs.pytest.org/en/stable/) and run `pytest`.
215+
216+
The last four checks are also run in CI, so a PR must pass all the tests for it to be mmerged.
217+
218+
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.
219+
The available dependency groups can be found in the `pyproject.toml` file.
215220

216221
## How to Release?
217222

pyproject.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ build-backend = "setuptools.build_meta"
4646

4747
[tool.setuptools.packages.find]
4848
include=["safeeyes*"]
49+
exclude=["safeeyes.tests*"]
4950

5051
[dependency-groups]
5152
dev = [
5253
{include-group = "lint"},
5354
{include-group = "scripts"},
54-
{include-group = "types"}
55+
{include-group = "tests"},
56+
{include-group = "types"},
5557
]
5658
lint = [
5759
"ruff==0.11.2"
@@ -64,7 +66,11 @@ types = [
6466
"PyGObject-stubs==2.13.0",
6567
"types-croniter==5.0.1.20250322",
6668
"types-psutil==7.0.0.20250218",
67-
"types-python-xlib==0.33.0.20240407"
69+
"types-python-xlib==0.33.0.20240407",
70+
{include-group = "tests"},
71+
]
72+
tests = [
73+
"pytest==8.3.5",
6874
]
6975

7076
[tool.mypy]
@@ -78,3 +84,8 @@ enable_error_code = [
7884
"ignore-without-code",
7985
"possibly-undefined"
8086
]
87+
88+
[tool.pytest.ini_options]
89+
addopts = [
90+
"--import-mode=importlib",
91+
]

safeeyes/tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)