pytest-bec-e2e 2.9.3__py3-none-any.whl → 2.9.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pytest-bec-e2e might be problematic. Click here for more details.
- PKG-INFO +1 -1
- pyproject.toml +1 -1
- pytest_bec_e2e/plugin.py +24 -11
- {pytest_bec_e2e-2.9.3.dist-info → pytest_bec_e2e-2.9.5.dist-info}/METADATA +1 -1
- pytest_bec_e2e-2.9.5.dist-info/RECORD +9 -0
- pytest_bec_e2e-2.9.3.dist-info/RECORD +0 -9
- {pytest_bec_e2e-2.9.3.dist-info → pytest_bec_e2e-2.9.5.dist-info}/WHEEL +0 -0
- {pytest_bec_e2e-2.9.3.dist-info → pytest_bec_e2e-2.9.5.dist-info}/entry_points.txt +0 -0
PKG-INFO
CHANGED
pyproject.toml
CHANGED
pytest_bec_e2e/plugin.py
CHANGED
|
@@ -9,6 +9,7 @@ import tempfile
|
|
|
9
9
|
|
|
10
10
|
import pytest
|
|
11
11
|
from pytest_redis import factories as pytest_redis_factories
|
|
12
|
+
from redis import Redis
|
|
12
13
|
|
|
13
14
|
from bec_ipython_client import BECIPythonClient
|
|
14
15
|
from bec_lib import BECClient, ConfigHelper, RedisConnector, ServiceConfig
|
|
@@ -25,7 +26,7 @@ def pytest_addoption(parser):
|
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
redis_server_fixture = None
|
|
28
|
-
|
|
29
|
+
bec_redis_fixture = None
|
|
29
30
|
_start_servers = False
|
|
30
31
|
bec_servers_scope = (
|
|
31
32
|
lambda fixture_name, config: config.getoption("--flush-redis") and "function" or "session"
|
|
@@ -72,7 +73,7 @@ def _get_tmp_dir():
|
|
|
72
73
|
@pytest.hookimpl
|
|
73
74
|
def pytest_configure(config):
|
|
74
75
|
global redis_server_fixture
|
|
75
|
-
global
|
|
76
|
+
global bec_redis_fixture
|
|
76
77
|
global _start_servers
|
|
77
78
|
global _bec_servers_scope
|
|
78
79
|
|
|
@@ -92,12 +93,12 @@ def pytest_configure(config):
|
|
|
92
93
|
)
|
|
93
94
|
|
|
94
95
|
if config.getoption("--flush-redis"):
|
|
95
|
-
|
|
96
|
+
bec_redis_fixture = pytest_redis_factories.redisdb("redis_server_fixture")
|
|
96
97
|
_bec_servers_scope = "function" # have to restart servers at each test
|
|
97
98
|
else:
|
|
98
|
-
|
|
99
|
+
bec_redis_fixture = redis_server_fixture
|
|
99
100
|
else:
|
|
100
|
-
# do not automatically start redis -
|
|
101
|
+
# do not automatically start redis - bec_redis_fixture will use existing
|
|
101
102
|
# process, will wait for 3 seconds max (must be running already);
|
|
102
103
|
# there is no point checking if we want to flush redis
|
|
103
104
|
# since it would remove available scans which are only populated
|
|
@@ -105,7 +106,7 @@ def pytest_configure(config):
|
|
|
105
106
|
redis_server_fixture = pytest_redis_factories.redis_noproc(
|
|
106
107
|
host=config.getoption("--bec-redis-host"), startup_timeout=3
|
|
107
108
|
)
|
|
108
|
-
|
|
109
|
+
bec_redis_fixture = redis_server_fixture
|
|
109
110
|
|
|
110
111
|
_start_servers = config.getoption("--start-servers")
|
|
111
112
|
|
|
@@ -134,14 +135,24 @@ def bec_test_config_file_path(bec_files_path):
|
|
|
134
135
|
return pathlib.Path(bec_files_path / "test_config.yaml")
|
|
135
136
|
|
|
136
137
|
|
|
138
|
+
@pytest.fixture(scope=bec_servers_scope)
|
|
139
|
+
def bec_redis_host_port(request, bec_redis_fixture):
|
|
140
|
+
if isinstance(bec_redis_fixture, Redis):
|
|
141
|
+
server_fixture = request.getfixturevalue("redis_server_fixture")
|
|
142
|
+
return server_fixture.host, server_fixture.port
|
|
143
|
+
else:
|
|
144
|
+
return bec_redis_fixture.host, bec_redis_fixture.port
|
|
145
|
+
|
|
146
|
+
|
|
137
147
|
@pytest.fixture(scope=bec_servers_scope)
|
|
138
148
|
def bec_servers(
|
|
139
149
|
test_config_yaml_file_path,
|
|
140
150
|
bec_services_config_file_path,
|
|
141
151
|
bec_test_config_file_path,
|
|
142
152
|
bec_files_path,
|
|
143
|
-
|
|
153
|
+
bec_redis_host_port,
|
|
144
154
|
):
|
|
155
|
+
redis_host, redis_port = bec_redis_host_port
|
|
145
156
|
# ensure configuration files are written where appropriate for tests,
|
|
146
157
|
# i.e. either in /tmp/pytest/... directory, or following user "--files-path"
|
|
147
158
|
# 1) test config (devices...)
|
|
@@ -154,8 +165,8 @@ def bec_servers(
|
|
|
154
165
|
services_config_file.write(
|
|
155
166
|
services_config_template
|
|
156
167
|
% {
|
|
157
|
-
"redis_host":
|
|
158
|
-
"redis_port":
|
|
168
|
+
"redis_host": redis_host,
|
|
169
|
+
"redis_port": redis_port,
|
|
159
170
|
"file_writer_base_path": file_writer_path,
|
|
160
171
|
}
|
|
161
172
|
)
|
|
@@ -183,7 +194,9 @@ def bec_servers(
|
|
|
183
194
|
|
|
184
195
|
|
|
185
196
|
@pytest.fixture
|
|
186
|
-
def bec_ipython_client_with_demo_config(
|
|
197
|
+
def bec_ipython_client_with_demo_config(
|
|
198
|
+
bec_redis_fixture, bec_services_config_file_path, bec_servers
|
|
199
|
+
):
|
|
187
200
|
config = ServiceConfig(bec_services_config_file_path)
|
|
188
201
|
bec = BECIPythonClient(config, RedisConnector, forced=True)
|
|
189
202
|
bec.start()
|
|
@@ -196,7 +209,7 @@ def bec_ipython_client_with_demo_config(bec_redis, bec_services_config_file_path
|
|
|
196
209
|
|
|
197
210
|
|
|
198
211
|
@pytest.fixture
|
|
199
|
-
def bec_client_lib_with_demo_config(
|
|
212
|
+
def bec_client_lib_with_demo_config(bec_redis_fixture, bec_services_config_file_path, bec_servers):
|
|
200
213
|
config = ServiceConfig(bec_services_config_file_path)
|
|
201
214
|
bec = BECClient(config, RedisConnector, forced=True, wait_for_server=True)
|
|
202
215
|
bec.start()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
.gitignore,sha256=cgNvnvYMgOWjrnVQEgTN5r33OPWtMgSAZF2c0L8_V84,3297
|
|
2
|
+
PKG-INFO,sha256=RQ3wUYTB89WuCsDnuHk7mt9sYUfnHQn3g4lGLINJLXA,515
|
|
3
|
+
pyproject.toml,sha256=K17J5bRaRPohR2j5zhHh5r0CSXAZPqeeW5lfcFH5IaE,769
|
|
4
|
+
pytest_bec_e2e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
pytest_bec_e2e/plugin.py,sha256=Lit1JNbcRL7JunXO8CyNj4exP9szoGSRb95MTFYUfMs,8191
|
|
6
|
+
pytest_bec_e2e-2.9.5.dist-info/METADATA,sha256=RQ3wUYTB89WuCsDnuHk7mt9sYUfnHQn3g4lGLINJLXA,515
|
|
7
|
+
pytest_bec_e2e-2.9.5.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
|
8
|
+
pytest_bec_e2e-2.9.5.dist-info/entry_points.txt,sha256=FLvRZqsjOQkvTOuo9A2kiyG9vMBia2sXREgVHb35DXA,56
|
|
9
|
+
pytest_bec_e2e-2.9.5.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
.gitignore,sha256=cgNvnvYMgOWjrnVQEgTN5r33OPWtMgSAZF2c0L8_V84,3297
|
|
2
|
-
PKG-INFO,sha256=rk046YIc4JWcHZp7tOtrw-FBQUqqVGaXg3J-ljqohKg,515
|
|
3
|
-
pyproject.toml,sha256=kQTf72kPPSHTV9gUaBQT7yK7MV07KMMx022ipelBfrA,769
|
|
4
|
-
pytest_bec_e2e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
pytest_bec_e2e/plugin.py,sha256=HHjAkLtzddvSpuL33zHDag3XeyL5_a1AZ614kIT8xEQ,7737
|
|
6
|
-
pytest_bec_e2e-2.9.3.dist-info/METADATA,sha256=rk046YIc4JWcHZp7tOtrw-FBQUqqVGaXg3J-ljqohKg,515
|
|
7
|
-
pytest_bec_e2e-2.9.3.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
|
8
|
-
pytest_bec_e2e-2.9.3.dist-info/entry_points.txt,sha256=FLvRZqsjOQkvTOuo9A2kiyG9vMBia2sXREgVHb35DXA,56
|
|
9
|
-
pytest_bec_e2e-2.9.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|