33 lines
722 B
Python
33 lines
722 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
pytestmark = pytest.mark.pytest
|
|
|
|
from byteb4rb1e.utils.testing.pytest import get_current_test
|
|
from byteb4rb1e.utils.testing.pytest.decorators import run_in_subprocess_once
|
|
|
|
|
|
class Test_get_current_test:
|
|
"""
|
|
"""
|
|
|
|
def test_default(self):
|
|
"""
|
|
"""
|
|
os.environ['PYTEST_CURRENT_TEST'] = 'foo::bar (something)'
|
|
|
|
result = get_current_test()
|
|
|
|
assert isinstance(result[0], Path)
|
|
assert str(result[0].name) == 'foo'
|
|
|
|
assert result[1] == 'bar'
|
|
|
|
def test_invalid(self):
|
|
"""
|
|
"""
|
|
del os.environ['PYTEST_CURRENT_TEST']
|
|
with pytest.raises(RuntimeError):
|
|
get_current_test()
|