Skip to content

Commit 68ab2f0

Browse files
authored
Merge pull request #8 from pomponchik/develop
0.0.7
2 parents 4b90ca0 + 7ab73a6 commit 68ab2f0

10 files changed

Lines changed: 152 additions & 15 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: pomponchik
7+
8+
---
9+
10+
## Short description
11+
12+
Replace this text with a short description of the error and the behavior that you expected to see instead.
13+
14+
15+
## Describe the bug in detail
16+
17+
Please add this test in such a way that it reproduces the bug you found and does not pass:
18+
19+
```python
20+
def test_your_bug():
21+
...
22+
```
23+
24+
Writing the test, please keep compatibility with the [`pytest`](https://docs.pytest.org/) framework.
25+
26+
If for some reason you cannot describe the error in the test format, describe here the steps to reproduce it.
27+
28+
29+
## Environment
30+
- OS: ...
31+
- Python version (the output of the `python --version` command): ...
32+
- Version of this package: ...
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Documentation fix
3+
about: Add something to the documentation, delete it, or change it
4+
title: ''
5+
labels: documentation
6+
assignees: pomponchik
7+
---
8+
9+
## It's cool that you're here!
10+
11+
Documentation is an important part of the project, we strive to make it high-quality and keep it up to date. Please adjust this template by outlining your proposal.
12+
13+
14+
## Type of action
15+
16+
What do you want to do: remove something, add it, or change it?
17+
18+
19+
## Where?
20+
21+
Specify which part of the documentation you want to make a change to? For example, the name of an existing documentation section or the line number in a file `README.md`.
22+
23+
24+
## The essence
25+
26+
Please describe the essence of the proposed change
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: pomponchik
7+
8+
---
9+
10+
## Short description
11+
12+
What do you propose and why do you consider it important?
13+
14+
15+
## Some details
16+
17+
If you can, provide code examples that will show how your proposal will work. Also, if you can, indicate which alternatives to this behavior you have considered. And finally, how do you propose to test the correctness of the implementation of your idea, if at all possible?

.github/ISSUE_TEMPLATE/question.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: Question or consultation
3+
about: Ask anything about this project
4+
title: ''
5+
labels: guestion
6+
assignees: pomponchik
7+
8+
---
9+
10+
## Your question
11+
12+
Here you can freely describe your question about the project. Please, before doing this, read the documentation provided, and ask the question only if the necessary answer is not there. In addition, please keep in mind that this is a free non-commercial project and user support is optional for its author. The response time is not guaranteed in any way.

.github/workflows/lint.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: ['3.7']
12+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
1313

1414
steps:
1515
- uses: actions/checkout@v2
1616

1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v1
18+
uses: actions/setup-python@v3
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121

@@ -31,6 +31,14 @@ jobs:
3131
shell: bash
3232
run: mypy cbfa --strict
3333

34+
- name: Run mypy for tests
35+
shell: bash
36+
run: mypy tests
37+
3438
- name: Run ruff
3539
shell: bash
36-
run: ruff cbfa
40+
run: ruff check cbfa
41+
42+
- name: Run ruff for tests
43+
shell: bash
44+
run: ruff check tests

.github/workflows/tests_and_coverage.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: tests
1+
name: Tests
22

33
on:
44
push
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
os: [macos-latest, ubuntu-latest, windows-latest]
13-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
13+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
1414

1515
steps:
1616
- uses: actions/checkout@v2
@@ -28,7 +28,7 @@ jobs:
2828
run: pip install -r requirements_dev.txt
2929

3030
- name: Run tests and show coverage on the command line
31-
run: coverage run --source=cbfa --omit="*tests*" -m pytest --cache-clear && coverage report -m
31+
run: coverage run --source=cbfa --omit="*tests*" -m pytest --cache-clear && coverage report -m --fail-under=100
3232

3333
- name: Upload reports to codecov
3434
env:
@@ -39,3 +39,6 @@ jobs:
3939
find . -iregex "codecov.*"
4040
chmod +x codecov
4141
./codecov -t ${CODECOV_TOKEN}
42+
43+
- name: Run tests and show the branch coverage on the command line
44+
run: coverage run --branch --source=cbfa --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ venv
1212
.pytest_cache
1313
test.py
1414
.mypy_cache
15+
.coverage
16+
htmlcov

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ build-backend = 'setuptools.build_meta'
44

55
[project]
66
name = 'cbfa'
7-
version = '0.0.6'
7+
version = '0.0.7'
88
authors = [
99
{ name='Evgeniy Blinov', email='zheni-b@yandex.ru' },
1010
]
1111
description = 'Class-based views for the FastAPI'
1212
readme = 'README.md'
13-
requires-python = '>=3.7'
13+
requires-python = '>=3.8'
1414
dependencies = [
1515
'fastapi',
1616
]
@@ -20,12 +20,12 @@ classifiers = [
2020
'Operating System :: POSIX',
2121
'Operating System :: POSIX :: Linux',
2222
'Programming Language :: Python',
23-
'Programming Language :: Python :: 3.7',
2423
'Programming Language :: Python :: 3.8',
2524
'Programming Language :: Python :: 3.9',
2625
'Programming Language :: Python :: 3.10',
2726
'Programming Language :: Python :: 3.11',
2827
'Programming Language :: Python :: 3.12',
28+
'Programming Language :: Python :: 3.13',
2929
'License :: OSI Approved :: MIT License',
3030
'Intended Audience :: Developers',
3131
'Topic :: Software Development :: Libraries',

requirements_dev.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
pytest==7.4.2
2-
coverage==7.2.7
3-
twine==4.0.2
1+
pytest==7.4.3
2+
coverage==7.6.1
3+
twine==6.1.0
44
wheel==0.40.0
5-
build==0.9.0
6-
ruff==0.0.290
7-
mypy==1.4.1
5+
build==1.2.2.post1
6+
ruff==0.9.9
7+
mypy==1.14.1
8+
mutmut==3.2.3

tests/units/test_class_based.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ def patch(self, url):
3434
return lambda x: x
3535

3636

37+
class PseudoAppWithoutHTTPMethods:
38+
def __init__(self):
39+
self.calls = []
40+
41+
3742
def test_wrap_only_get():
3843
app = PseudoApp()
3944
wrapper = ClassBased(app)
@@ -73,3 +78,34 @@ def patch():
7378
pass
7479

7580
assert app.calls == [('get', url), ('post', url), ('put', url), ('delete', url), ('trace', url), ('head', url), ('options', url), ('connect', url), ('patch', url)]
81+
82+
83+
def test_wrap_something_which_is_not_supported_in_app():
84+
url = '/kek'
85+
app = PseudoAppWithoutHTTPMethods()
86+
wrapper = ClassBased(app)
87+
88+
@wrapper(url)
89+
class SomeItem:
90+
def get():
91+
pass
92+
def post():
93+
pass
94+
def put():
95+
pass
96+
def delete():
97+
pass
98+
def trace():
99+
pass
100+
def head():
101+
pass
102+
def options():
103+
pass
104+
def connect():
105+
pass
106+
def patch():
107+
pass
108+
def kek():
109+
pass
110+
111+
assert app.calls == []

0 commit comments

Comments
 (0)