Skip to content

Commit 90df9a0

Browse files
committed
Fixed mypy for Python 3.10
1 parent 1fb1219 commit 90df9a0

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

exasol/nb_connector/itde_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ def restart_itde(conf: Secrets) -> None:
209209
if status is ItdeContainerStatus.ABSENT:
210210
raise RuntimeError("The Docker-DB container doesn't exist.")
211211

212-
if ItdeContainerStatus.RUNNING not in status:
212+
if ItdeContainerStatus.RUNNING not in status: # type: ignore[operator]
213213
container_name = conf.get(AILabConfig.itde_container)
214214
with ContextDockerClient() as docker_client:
215215
container = docker_client.containers.get(container_name)
216216
container.start()
217217

218-
if ItdeContainerStatus.VISIBLE not in status:
218+
if not ItdeContainerStatus.VISIBLE not in status: # type: ignore[operator]
219219
network_name = conf.get(AILabConfig.itde_network)
220220
if network_name:
221221
_add_current_container_to_db_network(network_name)
@@ -272,3 +272,4 @@ def remove_container(conf):
272272
if container_name:
273273
remove_docker_container([container_name])
274274
conf.remove(AILabConfig.itde_container)
275+

test/unit/test_itde_manager.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
NAME_SERVER_ADDRESS,
2222
bring_itde_up,
2323
take_itde_down,
24+
ItdeContainerStatus,
2425
)
2526

2627
TEST_CONTAINER_NAME = "the_new_container"
@@ -106,3 +107,37 @@ def test_take_itde_down(mock_util1, mock_util2, mock_util3, secrets):
106107
assert secrets.get(CKey.bfs_user) is None
107108
assert secrets.get(CKey.bfs_password) is None
108109
assert secrets.get(CKey.bfs_port) is None
110+
111+
112+
@pytest.mark.parametrize("status", [
113+
ItdeContainerStatus.RUNNING,
114+
ItdeContainerStatus.READY,
115+
])
116+
def test_status_running(status):
117+
assert ItdeContainerStatus.RUNNING in status
118+
119+
120+
@pytest.mark.parametrize("status", [
121+
ItdeContainerStatus.ABSENT,
122+
ItdeContainerStatus.STOPPED,
123+
ItdeContainerStatus.VISIBLE,
124+
])
125+
def test_status_not_running(status):
126+
assert ItdeContainerStatus.RUNNING not in status
127+
128+
129+
@pytest.mark.parametrize("status", [
130+
ItdeContainerStatus.VISIBLE,
131+
ItdeContainerStatus.READY,
132+
])
133+
def test_status_visible(status):
134+
assert ItdeContainerStatus.VISIBLE in status
135+
136+
137+
@pytest.mark.parametrize("status", [
138+
ItdeContainerStatus.ABSENT,
139+
ItdeContainerStatus.STOPPED,
140+
ItdeContainerStatus.RUNNING,
141+
])
142+
def test_status_not_visible(status):
143+
assert ItdeContainerStatus.VISIBLE not in status

0 commit comments

Comments
 (0)