coincidence.fixtures
Pytest fixtures.
To enable the fixtures add the following to conftest.py
in your test directory:
pytest_plugins = ("coincidence", )
See the pytest documentation for more information.
Functions:
|
Pytest fixture to pretend the current datetime is 2:20 AM on 13th October 2020. |
|
Parametrized pytest fixture which returns the current filesystem path separator and skips the test for the other. |
|
Pytest fixture which returns a temporary directory in the form of a |
-
fixture
fixed_datetime
[source] Scope: function
Pytest fixture to pretend the current datetime is 2:20 AM on 13th October 2020.
See also
The
with_fixed_datetime()
contextmanager.Attention
The monkeypatching only works when datetime is used and imported like:
import datetime print(datetime.datetime.now())
Using
from datetime import datetime
won’t work.- Return type
-
fixture
path_separator
[source] Scope: function
Parametrized pytest fixture which returns the current filesystem path separator and skips the test for the other.
This is useful when the test output differs on platforms with
\
as the path separator, such as windows.New in version 0.4.0.
- Return type
-
fixture
tmp_pathplus
[source] Scope: function
Pytest fixture which returns a temporary directory in the form of a
PathPlus
object.The directory is unique to each test function invocation, created as a sub directory of the base temporary directory.
Use it as follows:
pytest_plugins = ("coincidence", ) def test_something(tmp_pathplus: PathPlus): assert True
- Return type