-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dca7c8d
commit 6fee861
Showing
7 changed files
with
104 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Lock clean | ||
|
||
## Resume | ||
The idea is as follows: the idea is to have a command to delete all locked tests. This will delete all caches that still have an associated test using `fixture` lock. `--clean` will delete all locked tests, and you will be warned that the tests are no longer locked. | ||
|
||
## Usage | ||
|
||
### Create tests | ||
|
||
Create a test file, use the __lock__ fixture, for example `test_sum.py` in the `tests` directory. Here's an example: | ||
|
||
```python | ||
from pytest_lock import FixtureLock | ||
|
||
|
||
def test_lock_sum(lock: FixtureLock): | ||
args = [1, 2, 3] | ||
lock.lock(sum, (args,)) | ||
``` | ||
|
||
### Locking Tests | ||
Run pytest with the `--lock` option to generate the lock files: | ||
|
||
```bash | ||
pytest --lock | ||
``` | ||
|
||
This will generate Pickle files in a `.pytest-lock` directory, storing the results of the locked tests. | ||
|
||
### Use clean | ||
|
||
Simply run pytest with the `--clean` option to delete all locked tests: | ||
|
||
```bash | ||
pytest --lock --clean | ||
``` | ||
|
||
The cache of your tests will be deleted and you will be warned that the tests are no longer locked. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Lock tests extension | ||
|
||
## Usage | ||
|
||
You can choose the extension of the lock file, you just need to add `extension='json'` for example. The default extension is `pickle`. If you choose a extension using string like json, you must lock a function who return a json serializable object. | ||
|
||
- `pickle` (default) | ||
- `json` (must have StrSupport with `__str__` method) | ||
### Create tests | ||
|
||
Create a test file, use the __lock__ fixture, for example `test_sum.py` in the `tests` directory. Here's an example: | ||
|
||
```python | ||
from pytest_lock import FixtureLock | ||
|
||
|
||
def test_lock_sum(lock: FixtureLock): | ||
args = [1, 2, 3] | ||
lock.lock(sum, (args,), extension='json') | ||
``` | ||
|
||
### Locking Tests | ||
Run pytest with the `--lock` option to generate the lock files: | ||
|
||
```bash | ||
pytest --lock | ||
``` | ||
|
||
This will generate JSON files in a `.pytest-lock` directory, storing the results of the locked tests. | ||
|
||
### Running Tests | ||
|
||
Simply run pytest as you normally would: | ||
|
||
```bash | ||
pytest | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.