Skip to content

Commit 5df36f5

Browse files
committed
pytest fixture builded
1 parent 2bc806f commit 5df36f5

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test_pytest_person.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import time
2+
3+
import pytest
4+
5+
from person import Person
6+
7+
8+
class TestPerson:
9+
10+
@pytest.fixture
11+
def setup(self):
12+
self.p1 = Person('rezoo', 'mob')
13+
self.p2 = Person('mik', 'raz')
14+
yield 'setup'
15+
time.sleep(2)
16+
17+
def test_fullname(self, setup):
18+
assert self.p1.fullname() == 'rezoo mob'
19+
assert self.p2.fullname() == 'mik raz'
20+
21+
def test_email(self, setup):
22+
assert self.p1.email() == 'rezoomob@email.com'
23+
assert self.p2.email() == 'mikraz@email.com'

0 commit comments

Comments
 (0)