mirror of https://github.com/hwchase17/langchain
pytest experiments 2
parent
1af7133828
commit
80c65150f0
@ -0,0 +1,24 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Optional
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
class BaseUnitTests(ABC):
|
||||
@abstractmethod
|
||||
@pytest.fixture
|
||||
def my_fixture(self) -> int:
|
||||
...
|
||||
|
||||
@pytest.fixture
|
||||
def my_second_fixture(self) -> Optional[int]:
|
||||
return None # default value
|
||||
|
||||
def test_a(self, my_fixture: int) -> None:
|
||||
assert False, f"test_a {my_fixture}"
|
||||
|
||||
def test_b(self, my_fixture: int) -> None:
|
||||
assert False, f"test_b {my_fixture}"
|
||||
|
||||
def test_c(self, my_second_fixture: Optional[int]) -> None:
|
||||
assert False, f"test_c {my_second_fixture}"
|
@ -0,0 +1,9 @@
|
||||
import pytest
|
||||
|
||||
from ._helper import BaseUnitTests
|
||||
|
||||
|
||||
class TestOne(BaseUnitTests):
|
||||
@pytest.fixture
|
||||
def my_fixture(self) -> int:
|
||||
return 1
|
@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
|
||||
from ._helper import BaseUnitTests
|
||||
|
||||
|
||||
class TestTwo(BaseUnitTests):
|
||||
@pytest.fixture
|
||||
def my_fixture(self) -> int:
|
||||
return 2
|
||||
|
||||
@pytest.fixture
|
||||
def my_second_fixture(self) -> int:
|
||||
return 3
|
Loading…
Reference in New Issue