Skip to content

Commit

Permalink
Merge pull request #21 from BrianPugh/formal-typed
Browse files Browse the repository at this point in the history
Formal typed
  • Loading branch information
BrianPugh authored Feb 25, 2023
2 parents 68a527a + ef09609 commit eb3d489
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,30 @@ on:

jobs:
test:
timeout-minutes: 45
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}

steps:
- name: Set OS Environment Variables (Windows)
if: runner.os == 'Windows'
run: |
echo 'ACTIVATE_PYTHON_VENV=.venv/scripts/activate' >> $GITHUB_ENV
- name: Set OS Environment Variables (not Windows)
if: runner.os != 'Windows'
run: |
echo 'ACTIVATE_PYTHON_VENV=.venv/bin/activate' >> $GITHUB_ENV
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
Expand Down Expand Up @@ -80,15 +94,15 @@ jobs:
#----------------------------------------------
- name: Sanity check with flake8
run: |
source .venv/bin/activate
source ${{ env.ACTIVATE_PYTHON_VENV }}
# stop the build if there are Python syntax errors or undefined names
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings
python -m flake8 . --count --exit-zero --statistics
- name: Run tests
run: |
source .venv/bin/activate
source ${{ env.ACTIVATE_PYTHON_VENV }}
python -m pytest --cov=autoregistry --cov-report term --cov-report xml --cov-config .coveragerc --junitxml=testresults.xml
coverage report
Expand All @@ -105,5 +119,5 @@ jobs:
#----------------------------------------------
- name: Build HTML docs
run: |
source .venv/bin/activate
source ${{ env.ACTIVATE_PYTHON_VENV }}
sphinx-build -b html docs/source/ docs/build/html
14 changes: 12 additions & 2 deletions autoregistry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Don't manually change, let poetry-dynamic-versioning-plugin handle it.
__version__ = "0.0.0"

from .config import RegistryConfig
__all__ = [
"CannotDeriveNameError",
"CannotRegisterPythonBuiltInError",
"InvalidNameError",
"KeyCollisionError",
"ModuleAliasError",
"Registry",
"RegistryError",
"RegistryMeta",
]

from .exceptions import (
CannotDeriveNameError,
CannotRegisterPythonBuiltInError,
Expand All @@ -10,4 +20,4 @@
ModuleAliasError,
RegistryError,
)
from .registry import Registry, RegistryDecorator, RegistryMeta
from .registry import Registry, RegistryMeta
Empty file added autoregistry/py.typed
Empty file.
8 changes: 8 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,11 @@
"includehidden": True,
"titles_only": False,
}

html_context = {
# Github options
"display_github": True,
"github_user": "BrianPugh",
"github_repo": "autoregistry",
"github_version": "main/docs/",
}
5 changes: 3 additions & 2 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

import autoregistry
from autoregistry.config import RegistryConfig
from autoregistry.regex import key_split, to_snake_case
from autoregistry.registry import _Registry

Expand All @@ -16,7 +17,7 @@ def test_to_snake():


def test_registry_config_update():
config = autoregistry.RegistryConfig()
config = RegistryConfig()
config.update(
{
"suffix": "test",
Expand All @@ -28,7 +29,7 @@ def test_registry_config_update():


def test_registry_config_cannot_derive_name():
__registry__ = _Registry(autoregistry.RegistryConfig())
__registry__ = _Registry(RegistryConfig())
foo = "foo"
with pytest.raises(autoregistry.CannotDeriveNameError):
__registry__.register(foo)
Expand Down

0 comments on commit eb3d489

Please sign in to comment.