Releases: Athroniaeth/pytest-lock
v1.0.1
Patch lock.lock
if not tuple is given in lock.lock
and that arguments was given directly, throw exception.
Problem:
import pytest
from pytest_lock import FixtureLock
def sum_(list_numbers):
if not list_numbers:
raise ValueError("The list is empty")
return sum(list_numbers)
@pytest.mark.parametrize("list_numbers", (
[1, 2, 3],
[1, 2, 3, 4],
[1, 2, 3, 4, 5],
[]
))
def test_sum(lock: FixtureLock, list_numbers):
lock.lock(sum_, list_numbers)
pytest --lock
pytest
Pytest-lock will work but with this modification.
def sum_(list_numbers):
if not list_numbers:
raise ValueError("The list is empty")
return sum(list_numbers) + 1000
The test will always passed. The reason is because lock.lock wait a Tuple of arguments (no need to have *args and **kwargs in function) but if you give a Sequence, pytest-lock don't will understand and will still try to make the code work. Now if you don't wrap your arguments in a tuple an error will be thrown
v1.0.0
Version v1.0.0
- Date: 2024-02-03
- Version: >=3.8 and <=3.12
- Note : this version break major versioning, because old acceptation test fail for this reason
branch: "feature/lock-fixture"
- Status: Finish
- Note: Branch containing the base of the pytest fixture 'lock', it must be able to easily integrate new functions, CLI arguments, etc…
- Modified
--lock
argument, now target only test withlock
fixture- The tests with the
lock
fixture hadskipped
status, now they havepassed
status - The tests without the
lock
fixture hadpassed
status, now they haveskipped
status
- The tests with the
branch: "feature/fixture-lock-pickle"
- Status: Finish
- Note: This branch requires that the branch "feature/fixture-lock-method" be finalized.
- Add
pickle
extension forlock.lock
to support more types of data - Now
pickle
is the default extension forlock.lock
if no extension is specified
branch: "feature/fixture-lock-clean"
- Status: Start
- Note: This branch requires that the branch "feature/fixture-lock-method" be finalized.
- If test use
--lock
and--clean
argument, then clean all unused cache files - If test use
--lock
and--clean
argument and--only-skip
argument, then do anything, it's certainly a mistake (why clean only test with existing lock ?) - If test use
--lock
and--clean
argument and--simulate
argument, list all unused cache files who will be removed without remove them. - If test use
--lock
and--clean
argument and--lock-date
argument, thrown exception (can't lock a remove cache file)
v0.1.2
Version v0.1.2
- Date: 2024-01-27
- Version: >=3.8 and <=3.12
branch: "feature/lock-fixture"
- Status: Finish
- Note: Branch containing the base of the pytest fixture 'lock', it must be able to easily integrate new functions, CLI arguments, etc…
- Add fixtures
lock
branch: "feature/fixtures-lock-method"
- Status: Finish
- Note: This branch requires that the branch "feature/lock-fixture" be finalized.
-
Add fixtures method
lock.lock
to lock the result of a test to a cache file-
If test use
lock.lock
and result was not locked, exception is thrown -
If test use
lock.lock
result is in the cache file and is the same as the result of the test, test is valid -
If test use
lock.lock
result is in the cache file and is not the same as the result of the test, test is invalid (failed) -
If test use
lock.lock
and--lock
in cli argument, then start test and lock the result in cache file. -
If test use
lock.lock
and--simulate
in cli argument, then simulate the result of the test, not write to the cache file. -
If test use
lock.lock
and--only-skip
in cli argument, then don't update lock if the result was not locked. -
If test use
lock.lock
and--lock-date
in cli argument, then lock the result of the test to a cache file with the date of the lock, if date was expired, then the test is failed -
If test use
--simulate
argument and not--lock
argument, then it's invalid, throw exception -
If test use
--lock-date
argument and not--lock
argument, then it's invalid, throw exception -
If test use
--only-skip
argument and not--lock
argument, then it's invalid, throw exception
-
branch: "feature/fixture-lock-date-support"
- Status: Finish
- Note: This branch requires that the branch "feature/fixture-lock-method" be finalized.
- Add support for
pytest --lock --lock-date 13/12/2023
, if test haslock
fixture, then lock the result of the
test to a cache file with the date of the lock, if date was expired, then the test is skipped