Skip to content

Commit f625f02

Browse files
authored
Merge pull request #18 from pomponchik/develop
0.0.16
2 parents 1e4ee4d + 83d8739 commit f625f02

File tree

12 files changed

+161
-26
lines changed

12 files changed

+161
-26
lines changed
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/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: New tests
22

33
on:
44
push
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
os: [ubuntu-latest, windows-latest, macos-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']
1414

1515
steps:
1616
- uses: actions/checkout@v2
@@ -27,7 +27,7 @@ jobs:
2727
run: pip install .
2828

2929
- name: Run tests and show coverage on the command line
30-
run: coverage run --source=locklib --omit="*tests*" -m pytest --cache-clear && coverage report -m
30+
run: coverage run --source=locklib --omit="*tests*" -m pytest --cache-clear && coverage report -m --fail-under=100
3131

3232
- name: Upload reports to codecov
3333
env:
@@ -38,3 +38,6 @@ jobs:
3838
find . -iregex "codecov.*"
3939
chmod +x codecov
4040
./codecov -t ${CODECOV_TOKEN}
41+
42+
- name: Run tests and show the branch coverage on the command line
43+
run: coverage run --branch --source=locklib --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Old tests
2+
3+
on:
4+
push
5+
6+
jobs:
7+
build:
8+
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [macos-13, ubuntu-latest, windows-latest]
13+
python-version: ['3.7']
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v3
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Install the library
23+
shell: bash
24+
run: pip install .
25+
26+
- name: Install dependencies
27+
shell: bash
28+
run: pip install -r requirements_dev.txt
29+
30+
- name: Print all libs
31+
shell: bash
32+
run: pip list
33+
34+
- name: Run tests and show coverage on the command line
35+
run: coverage run --source=locklib --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100
36+
37+
- name: Upload reports to codecov
38+
env:
39+
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
40+
if: runner.os == 'Linux'
41+
run: |
42+
curl -Os https://uploader.codecov.io/latest/linux/codecov
43+
find . -iregex "codecov.*"
44+
chmod +x codecov
45+
./codecov -t ${CODECOV_TOKEN}
46+
47+
- name: Run tests and show the branch coverage on the command line
48+
run: coverage run --branch --source=locklib --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ If you use type hints and static verification tools like [mypy](https://github.c
111111
from threading import Thread
112112
from locklib import SmartLock
113113

114-
115114
lock = SmartLock()
116115
counter = 0
117116

@@ -136,7 +135,6 @@ Yeah, in this case the lock helps us not to get a race condition, as the standar
136135
from threading import Thread
137136
from locklib import SmartLock
138137

139-
140138
lock_1 = SmartLock()
141139
lock_2 = SmartLock()
142140

locklib/protocols/async_context_lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
class AsyncContextLockProtocol(LockProtocol, Protocol):
1414
def __aenter__(self) -> Any:
1515
raise NotImplementedError('Do not use the protocol as a lock.')
16-
return None
16+
return None # pragma: no cover
1717

1818
def __aexit__(self, exception_type: Optional[Type[BaseException]], exception_value: Optional[BaseException], traceback: Optional[TracebackType]) -> Any:
1919
raise NotImplementedError('Do not use the protocol as a lock.')
20-
return None
20+
return None # pragma: no cover

locklib/protocols/context_lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
class ContextLockProtocol(LockProtocol, Protocol):
1414
def __enter__(self) -> Any:
1515
raise NotImplementedError('Do not use the protocol as a lock.')
16-
return None
16+
return None # pragma: no cover
1717

1818
def __exit__(self, exception_type: Optional[Type[BaseException]], exception_value: Optional[BaseException], traceback: Optional[TracebackType]) -> Any:
1919
raise NotImplementedError('Do not use the protocol as a lock.')
20-
return None
20+
return None # pragma: no cover

locklib/protocols/lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
class LockProtocol(Protocol):
1010
def acquire(self) -> Any:
1111
raise NotImplementedError('Do not use the protocol as a lock.')
12-
return None
12+
return None # pragma: no cover
1313

1414
def release(self) -> Any:
1515
raise NotImplementedError('Do not use the protocol as a lock.')
16-
return None
16+
return None # pragma: no cover

0 commit comments

Comments
 (0)