fix type and config for tests

This commit is contained in:
Daniel 2023-12-11 01:44:02 +01:00
parent 8ba0121415
commit ba33d97c53
2 changed files with 14 additions and 25 deletions

View file

@ -1,30 +1,19 @@
repos: repos:
# - repo: local # - repo: local
# hooks: # hooks:
# - id: whitespace # - id: tests
# name: strip whitespace # name: run all tests that are not marked slow
# entry: ./strip_whitespace.sh # entry: python -m pytest -m "not slow"
# language: system # language: system
# always_run: true # language_version: default
# pass_filenames: false # always_run: true
# pass_filenames: false
# - id: mypy
# name: mypy
# entry: mypy pytest_abra/
# language: system
# always_run: true
# pass_filenames: false
# - id: tests
# name: run all tests that are not marked slow
# entry: pytest -m "not slow"
# language: system
# always_run: true
# pass_filenames: false
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: '' # Use the sha / tag you want to point at rev: '' # Use the sha / tag you want to point at
hooks: hooks:
- id: mypy - id: mypy
args: [--ignore-missing-imports]
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7 rev: v0.1.7

View file

@ -3,7 +3,8 @@
import os import os
import re import re
from datetime import datetime, timedelta
# from datetime import datetime, timedelta
from pathlib import Path from pathlib import Path
from typing import Generator, Protocol, TypedDict from typing import Generator, Protocol, TypedDict
@ -93,7 +94,7 @@ def URL(env_config: dict[str, str]) -> BaseUrl:
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def imap_client() -> Generator[Imbox]: def imap_client() -> Generator[Imbox, None, None]:
"""imap email client using credentials from environment variables""" """imap email client using credentials from environment variables"""
assert os.environ["IMAP_HOST"] assert os.environ["IMAP_HOST"]
@ -138,9 +139,8 @@ def imap_recent_messages(imap_client: Imbox) -> list[Message]:
for uid, message in messages: for uid, message in messages:
print(uid, message.subject, message.date)""" print(uid, message.subject, message.date)"""
N_MINUTES = 30 # N_MINUTES = 30
# n_minutes_ago = datetime.now() - timedelta(minutes=N_MINUTES)
n_minutes_ago = datetime.now() - timedelta(minutes=N_MINUTES)
uids: list[bytes] = [] uids: list[bytes] = []
messages: list[Message] = [] messages: list[Message] = []
# for uid, message in imap_client.messages(date__gt=n_minutes_ago): # for uid, message in imap_client.messages(date__gt=n_minutes_ago):