pytest-bec-e2e 2.9.4__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytest-bec-e2e
3
- Version: 2.9.4
3
+ Version: 2.9.5
4
4
  Summary: BEC pytest plugin for end-to-end tests
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pytest-bec-e2e"
7
- version = "2.9.4"
7
+ version = "2.9.5"
8
8
  description = "BEC pytest plugin for end-to-end tests"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [
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
- bec_redis = None
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 bec_redis
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
- bec_redis = pytest_redis_factories.redisdb("redis_server_fixture")
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
- bec_redis = redis_server_fixture
99
+ bec_redis_fixture = redis_server_fixture
99
100
  else:
100
- # do not automatically start redis - bec_redis will use existing
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
- bec_redis = redis_server_fixture
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
- redis_server_fixture,
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": redis_server_fixture.host,
158
- "redis_port": redis_server_fixture.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(bec_redis, bec_services_config_file_path, bec_servers):
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(bec_redis, bec_services_config_file_path, bec_servers):
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytest-bec-e2e
3
- Version: 2.9.4
3
+ Version: 2.9.5
4
4
  Summary: BEC pytest plugin for end-to-end tests
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec
@@ -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=fI2h6ikmvtwTVHnZs9NoR70gW3fdnnkoA-klWo7y3-A,515
3
- pyproject.toml,sha256=RDhLFwY6ZrDUKSbXlngvdr7FmcWZptJUS-MrDZ7Zrnc,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.4.dist-info/METADATA,sha256=fI2h6ikmvtwTVHnZs9NoR70gW3fdnnkoA-klWo7y3-A,515
7
- pytest_bec_e2e-2.9.4.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
8
- pytest_bec_e2e-2.9.4.dist-info/entry_points.txt,sha256=FLvRZqsjOQkvTOuo9A2kiyG9vMBia2sXREgVHb35DXA,56
9
- pytest_bec_e2e-2.9.4.dist-info/RECORD,,