Skip to content

Commit

Permalink
👷 Add test to the pipeline (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored Jun 16, 2023
1 parent 6a79d75 commit 7dfaa3b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,28 @@ jobs:
- uses: pre-commit/action@v3.0.0
with:
extra_args: --all-files


tests:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest

timeout-minutes: 30
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]


steps:
- uses: actions/checkout@v2

- name: set up python
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"

- name: Install hatch
run: pip install hatch

- name: Run tests
run: hatch run test
4 changes: 1 addition & 3 deletions bump_pydantic/codemods/add_default_none.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ class Foo(BaseModel):
```
"""

METADATA_DEPENDENCIES = {
FullyQualifiedNameProvider,
}
METADATA_DEPENDENCIES = (FullyQualifiedNameProvider,)

def __init__(self, context: CodemodContext) -> None:
super().__init__(context)
Expand Down
2 changes: 1 addition & 1 deletion bump_pydantic/codemods/replace_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def leave_config_class_childless(self, original_node: cst.ClassDef, updated_node
from `Config` class.
"""
AddImportsVisitor.add_needed_import(context=self.context, module="pydantic", obj="ConfigDict")
block = cst.ensure_type(original_node.body, cst.IndentedBlock)
block = cst.ensure_type(updated_node.body, cst.IndentedBlock)
body = [
cst.SimpleStatementLine(
body=[
Expand Down
4 changes: 3 additions & 1 deletion bump_pydantic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def main(
visitor.transform_module(module)
scratch = context.scratch

find_base_model(scratch["classes"])
find_base_model(context=context) # type: ignore[assignment]
scratch = context.scratch # type: ignore[assignment]

start_time = time.time()

Expand All @@ -78,6 +79,7 @@ def main(
filename=filename,
full_module_name=module_and_package.name,
full_package_name=module_and_package.package,
scratch=scratch,
)
)

Expand Down

0 comments on commit 7dfaa3b

Please sign in to comment.