Add tox configuration, we support 3.10 & 3.11 (#22)
parent
6b218a3926
commit
d602ddf3bf
|
|
@ -1,4 +1,4 @@
|
|||
name: Run pytest
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
|
@ -9,14 +9,23 @@ jobs:
|
|||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11', '3.10']
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest
|
||||
pip install tox
|
||||
|
||||
- name: Run pytest
|
||||
run: pytest
|
||||
- name: Run tox
|
||||
run: tox
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ Install via the extensions tab on the [AUTOMATIC1111 webui](https://github.com/A
|
|||
|
||||
Developed using existing [AUTOMATIC1111 webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) dependencies.
|
||||
|
||||
It's recommended to use the python version specified by A111 webui.
|
||||
|
||||
However - for running unit tests, we use pytest.
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from abc import ABC
|
||||
from abc import abstractmethod
|
||||
from functools import partial
|
||||
from typing import Callable
|
||||
|
||||
import gradio as gr
|
||||
|
||||
|
|
@ -190,7 +191,7 @@ class PredefinedAspectRatioButtons(ArhUIComponent):
|
|||
)
|
||||
|
||||
@property
|
||||
def display_func(self) -> callable:
|
||||
def display_func(self) -> Callable[[str], str]:
|
||||
return lambda _: None # todo: different displays for aspect ratios.
|
||||
|
||||
|
||||
|
|
@ -268,7 +269,7 @@ class PredefinedPercentageButtons(ArhUIComponent):
|
|||
)
|
||||
|
||||
@property
|
||||
def display_func(self) -> callable:
|
||||
def display_func(self) -> Callable[[str], str]:
|
||||
return _settings.PREDEFINED_PERCENTAGES_DISPLAY_MAP.get(
|
||||
_settings.safe_opt(
|
||||
_constants.ARH_PREDEFINED_PERCENTAGES_DISPLAY_KEY,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import contextlib
|
|||
import aspect_ratio_helper._constants as _const
|
||||
|
||||
|
||||
def safe_opt_util(shared_opts, key, default_key_map):
|
||||
def safe_opt_util(shared_opts, key, default_key_map: dict[str, object]):
|
||||
# attempt to retrieve key from shared options
|
||||
with contextlib.suppress(AttributeError):
|
||||
value = shared_opts.__getattr__(key)
|
||||
|
|
|
|||
Loading…
Reference in New Issue