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
24 changes: 24 additions & 0 deletions .github/workflows/ci..yml
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
name: ruff

on:
push:
workflow_dispatch:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: echo environment
run: echo ${{ github.ref }} && echo ${{ github.base_ref }} && echo ${{ github.head_ref }}
- name: if base is main
if: ${{ github.ref == 'refs/heads/main' }}
run: echo hat geklappt
- name: Install uv # https://eed-solutions.atlassian.net/wiki/spaces/ES/pages/782434388/Best+Practice+uv+package+management#Github-Actions
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: set up ruff
uses: astral-sh/ruff-action@v3
- name: Run Ruff
run: uv run ruff check --output-format=github
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.12.3
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi ]
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ build-backend = "hatchling.build"

[dependency-groups]
dev = [
"pre-commit>=4.2.0",
"pytest>=8.4.1",
"ruff>=0.12.3",
]
5 changes: 4 additions & 1 deletion src/eed_basic_utils/time/sleep_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@


def sleep_random(
minimum_seconds: float = 0, maximum_seconds: float = 1, seed: int = None, ndigits: int = None
minimum_seconds: float = 0,
maximum_seconds: float = 1,
seed: int = None,
ndigits: int = None,
) -> float:
"""
Pauses the program execution for a random duration between minimum_seconds and maximum_seconds.
Expand Down
4 changes: 0 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import pytest






@pytest.fixture(scope="session")
def cfg_test() -> Iterator[dict]:
home_dir = os.path.expanduser("~")
Expand Down
6 changes: 5 additions & 1 deletion tests/time/test_sleep_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
],
)
def test_sleep(
minimum_seconds, maximum_seconds, seed, minimum_seconds_expected, maximum_seconds_expected
minimum_seconds,
maximum_seconds,
seed,
minimum_seconds_expected,
maximum_seconds_expected,
):
result = sleep_random(minimum_seconds, maximum_seconds, seed)
assert minimum_seconds_expected <= result <= maximum_seconds_expected
152 changes: 151 additions & 1 deletion uv.lock

Large diffs are not rendered by default.

Loading