Skip to content

Commit 1669941

Browse files
update ci
1 parent 52be132 commit 1669941

File tree

6 files changed

+69
-11
lines changed

6 files changed

+69
-11
lines changed

.github/workflows/ci_filter.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,27 @@ jobs:
1111
max-parallel: 4
1212
matrix:
1313
os: [ubuntu-latest]
14-
python-version: ['3.9', '3.10', '3.11']
14+
python-version: ['3.9', '3.10', '3.11', '3.12']
1515

1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
- name: Setup Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v3
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies
2323
run: |
2424
python3 -m pip install --upgrade pip
25-
python3 -m pip install pipenv
26-
pipenv install --dev --skip-lock
25+
python3 -m pip install poetry
26+
poetry config virtualenvs.create false
27+
poetry lock
28+
poetry install --no-root
2729
- name: Run tests
2830
run: |
29-
pipenv run pytest -s
31+
poetry run pytest -s
3032
- name: Run flake8
3133
run: |
32-
pipenv run flake8 --max-line-length=120
34+
poetry run flake8 --max-line-length=120
3335
- name: Upload coverage reports to Codecov
3436
uses: codecov/codecov-action@v3
3537
env:

fastapi_sa_orm_filter/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ class model.__name__(BaseModel):
148148
optional_model = self._get_optional_pydantic_model(model, pydantic_serializer)
149149
optional_list_model = self._get_optional_pydantic_model(model, pydantic_serializer, is_list=True)
150150

151-
serializers[model.__tablename__] = {"optional_model": optional_model, "optional_list_model":optional_list_model}
151+
serializers[model.__tablename__] = {
152+
"optional_model": optional_model, "optional_list_model": optional_list_model
153+
}
152154

153155
return serializers
154156

fastapi_sa_orm_filter/parsers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def _parse_expression(
101101
model, table, field_name = self._get_relation_model(field_name)
102102
operator, value = condition.split("=")
103103
except ValueError:
104-
raise SAFilterOrmException("Incorrect filter request syntax,"
104+
raise SAFilterOrmException(
105+
"Incorrect filter request syntax,"
105106
" please use pattern :"
106107
"'{field_name}__{condition}={value}{conjunction}' "
107108
"or '{relation}.{field_name}__{condition}={value}{conjunction}'",

poetry.lock

Lines changed: 50 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pytest = "^8.3.3"
1717
pytest-asyncio = "^0.24.0"
1818
aiosqlite = "^0.20.0"
1919
flit = "^3.10.1"
20+
flake8 = "^7.1.1"
2021

2122

2223
[build-system]

tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Vacancy(Base):
3030
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
3131
company: Mapped["Company"] = relationship(back_populates="vacancies")
3232

33+
3334
class Company(Base):
3435
__tablename__ = "companies"
3536
id: Mapped[int] = mapped_column(primary_key=True)
@@ -145,6 +146,7 @@ def get_group_by_query_part(self):
145146

146147
return CustomFilter(Vacancy, get_vacancy_restriction)
147148

149+
148150
@pytest.fixture
149151
def get_company_restriction() -> dict:
150152
return {
@@ -153,6 +155,7 @@ def get_company_restriction() -> dict:
153155
"salary_from": [ops.eq, ops.gt, ops.lte, ops.gte]
154156
}
155157

158+
156159
@pytest.fixture
157160
def get_company_filter(get_company_restriction):
158161
return FilterCore(Company, get_company_restriction)
@@ -166,4 +169,4 @@ def get_query(self, custom_filter):
166169
query = super().get_query(custom_filter)
167170
return query.join(Vacancy).options(joinedload(Company.vacancies))
168171

169-
return CustomFilter(Company, get_company_restriction)
172+
return CustomFilter(Company, get_company_restriction)

0 commit comments

Comments
 (0)