Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc1a98b

Browse files
committed
tests: add pytest-run-parallel and mark thread-unsafe tests
related to #1255
1 parent 1b964af commit bc1a98b

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

tests/api/test_logging.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from pathlib import Path
22

33
import lief
4+
import pytest
45

56

67
def _remove_eol(string: str):
78
return string.replace("\n", "").replace("\r", "")
89

910

11+
@pytest.mark.thread_unsafe
1012
def test_filesink(tmp_path: Path):
1113
lief.logging.log(lief.logging.LEVEL.ERROR, "hello from default sink")
1214
out_log = tmp_path / "lief.log"
@@ -16,6 +18,7 @@ def test_filesink(tmp_path: Path):
1618
lief.logging.reset()
1719

1820

21+
@pytest.mark.thread_unsafe
1922
def test_stderr(capsys):
2023
lief.logging.log(lief.logging.LEVEL.ERROR, "This is an error")
2124
lief.logging.log(lief.logging.LEVEL.ERROR, "This is another error")
@@ -24,6 +27,7 @@ def test_stderr(capsys):
2427
assert _remove_eol(captured.err) == "This is an errorThis is another error"
2528

2629

30+
@pytest.mark.thread_unsafe
2731
def test_context_manager(capsys):
2832
lief.logging.reset()
2933
lief.logging.set_level(lief.logging.LEVEL.ERROR)

tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ pytest==9.0.3
22
requests==2.33.0
33
progressbar2==4.5.0
44
coverage==7.13.5
5+
pytest-run-parallel==0.8.2

0 commit comments

Comments
 (0)