add tests for dirmanager
This commit is contained in:
parent
1c2a957f99
commit
aa541de52f
1 changed files with 30 additions and 0 deletions
30
tests/test_dir_manager.py
Normal file
30
tests/test_dir_manager.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
import time
|
||||
import pytest
|
||||
from pytest_abra.dir_manager import DirManager
|
||||
from pathlib import Path
|
||||
|
||||
def test_get_latest_session_id_from_non_existing_dir(tmp_path: Path):
|
||||
out = DirManager.get_latest_session_id(tmp_path / "not_exist")
|
||||
assert out is None
|
||||
|
||||
def test_get_latest_session_id_from_empty_dir(tmp_path: Path):
|
||||
out = DirManager.get_latest_session_id(tmp_path)
|
||||
assert out is None
|
||||
|
||||
def test_get_latest_session_id_single(tmp_path: Path):
|
||||
(tmp_path / "a").mkdir()
|
||||
out = DirManager.get_latest_session_id(tmp_path)
|
||||
assert out == "a"
|
||||
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_get_latest_session_id(tmp_path: Path):
|
||||
(tmp_path / "a").mkdir()
|
||||
time.sleep(1.1)
|
||||
(tmp_path / "b").mkdir()
|
||||
out = DirManager.get_latest_session_id(tmp_path)
|
||||
assert out == "b"
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue