-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_benchmark.py
104 lines (74 loc) · 2.2 KB
/
test_benchmark.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import pytest
import Pyro4
from models import profile_deserializer
@pytest.fixture
def server(pytestconfig):
""" Configura uma instância do ArchiveServer para realizar os testes """
host_adress = pytestconfig.getoption("host")
uri = f"PYRO:ArchiveServer@{host_adress}:1234"
return Pyro4.Proxy(uri)
def item_1(server):
response = server.filter_by(field="education", value="Engenharia de Software")
software_engineers = profile_deserializer(response)
def item_2(server):
fortaleza_skills = server.list_skills_by_city(city="Fortaleza")
def item_3(server):
# 3. acrescentar uma nova experiência em um perfil;
new_experience = "Profesor de curso online de organização pessoal"
email = "[email protected]"
server.add_experience(email, new_experience)
def item_4(server):
# 4. dado o email do perfil, retornar sua experiência;
gabrielly_experience = server.get_experience(
email="[email protected]"
)
def item_5(server):
# 5. listar todas as informações de todos os perfis;
all_profiles = server.list_profiles()
def item_6(server):
# 6. dado o email de um perfil, retornar suas informações.
response = server.get_profile(email="[email protected]")
julio_profile = profile_deserializer(response)
# tests
def test_item_1(server, benchmark):
benchmark.pedantic(
item_1,
args=(server,),
rounds=20,
iterations=100,
)
def test_item_2(server, benchmark):
benchmark.pedantic(
item_2,
args=(server,),
rounds=20,
iterations=100,
)
def test_item_3(server, benchmark):
benchmark.pedantic(
item_3,
args=(server,),
rounds=20,
iterations=100,
)
def test_item_4(server, benchmark):
benchmark.pedantic(
item_4,
args=(server,),
rounds=20,
iterations=100,
)
def test_item_5(server, benchmark):
benchmark.pedantic(
item_5,
args=(server,),
rounds=20,
iterations=100,
)
def test_item_6(server, benchmark):
benchmark.pedantic(
item_6,
args=(server,),
rounds=20,
iterations=100,
)