cicada 0.6.0__tar.gz → 0.8.2__tar.gz

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.
Files changed (37) hide show
  1. {cicada-0.6.0 → cicada-0.8.2}/PKG-INFO +14 -2
  2. {cicada-0.6.0 → cicada-0.8.2}/cicada/cli.py +39 -0
  3. cicada-0.8.2/cicada/commands/delete_schedule.py +22 -0
  4. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/exec_schedule.py +0 -1
  5. cicada-0.8.2/cicada/commands/list_schedules.py +19 -0
  6. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/spread_schedules.py +0 -1
  7. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/upsert_schedule.py +0 -1
  8. {cicada-0.6.0 → cicada-0.8.2}/cicada/lib/postgres.py +2 -1
  9. {cicada-0.6.0 → cicada-0.8.2}/cicada/lib/scheduler.py +14 -1
  10. {cicada-0.6.0 → cicada-0.8.2}/cicada.egg-info/PKG-INFO +14 -2
  11. {cicada-0.6.0 → cicada-0.8.2}/cicada.egg-info/SOURCES.txt +9 -1
  12. cicada-0.8.2/cicada.egg-info/requires.txt +14 -0
  13. {cicada-0.6.0 → cicada-0.8.2}/setup.py +13 -13
  14. cicada-0.8.2/tests/test_functional_archive_logs.py +200 -0
  15. cicada-0.8.2/tests/test_functional_cli_entrypoint.py +333 -0
  16. cicada-0.8.2/tests/test_functional_main.py +774 -0
  17. cicada-0.8.2/tests/test_functional_spread_schedules.py +313 -0
  18. cicada-0.8.2/tests/test_lib_postgres.py +39 -0
  19. cicada-0.8.2/tests/test_lib_scheduler.py +58 -0
  20. cicada-0.6.0/cicada.egg-info/requires.txt +0 -14
  21. {cicada-0.6.0 → cicada-0.8.2}/LICENSE +0 -0
  22. {cicada-0.6.0 → cicada-0.8.2}/README.md +0 -0
  23. {cicada-0.6.0 → cicada-0.8.2}/cicada/__init__.py +0 -0
  24. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/__init__.py +0 -0
  25. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/archive_schedule_log.py +0 -0
  26. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/exec_server_schedules.py +0 -0
  27. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/list_server_schedules.py +0 -0
  28. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/ping_slack.py +0 -0
  29. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/register_server.py +0 -0
  30. {cicada-0.6.0 → cicada-0.8.2}/cicada/commands/show_schedule.py +0 -0
  31. {cicada-0.6.0 → cicada-0.8.2}/cicada/lib/__init__.py +0 -0
  32. {cicada-0.6.0 → cicada-0.8.2}/cicada/lib/utils.py +0 -0
  33. {cicada-0.6.0 → cicada-0.8.2}/cicada.egg-info/dependency_links.txt +0 -0
  34. {cicada-0.6.0 → cicada-0.8.2}/cicada.egg-info/entry_points.txt +0 -0
  35. {cicada-0.6.0 → cicada-0.8.2}/cicada.egg-info/top_level.txt +0 -0
  36. {cicada-0.6.0 → cicada-0.8.2}/pyproject.toml +0 -0
  37. {cicada-0.6.0 → cicada-0.8.2}/setup.cfg +0 -0
@@ -1,14 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cicada
3
- Version: 0.6.0
3
+ Version: 0.8.2
4
4
  Summary: Lightweight, agent-based, distributed scheduler
5
5
  Home-page: https://github.com/transferwise/cicada
6
6
  Author: Wise
7
7
  Classifier: License :: OSI Approved :: Apache Software License
8
8
  Classifier: Programming Language :: Python :: 3 :: Only
9
9
  Description-Content-Type: text/markdown
10
- Provides-Extra: dev
11
10
  License-File: LICENSE
11
+ Requires-Dist: psycopg2-binary==2.9.*
12
+ Requires-Dist: pyyaml==6.0.*
13
+ Requires-Dist: croniter==2.0.*
14
+ Requires-Dist: tabulate==0.9.*
15
+ Requires-Dist: slack-sdk==3.30.*
16
+ Requires-Dist: backoff==2.2.*
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest==8.2.*; extra == "dev"
19
+ Requires-Dist: pytest-cov==5.0.*; extra == "dev"
20
+ Requires-Dist: pytest-mock==3.14.*; extra == "dev"
21
+ Requires-Dist: black==24.4.*; extra == "dev"
22
+ Requires-Dist: flake8==7.1.*; extra == "dev"
23
+ Requires-Dist: freezegun==1.5.*; extra == "dev"
12
24
 
13
25
  # Cicada scheduler
14
26
 
@@ -3,6 +3,7 @@
3
3
  import argparse
4
4
  import sys
5
5
  import inspect
6
+ from pkg_resources import get_distribution
6
7
 
7
8
  from cicada.lib import utils
8
9
 
@@ -15,6 +16,8 @@ from cicada.commands import exec_schedule
15
16
  from cicada.commands import spread_schedules
16
17
  from cicada.commands import archive_schedule_log
17
18
  from cicada.commands import ping_slack
19
+ from cicada.commands import list_schedules
20
+ from cicada.commands import delete_schedule
18
21
 
19
22
 
20
23
  @utils.named_exception_handler("Cicada")
@@ -32,6 +35,9 @@ class Cicada:
32
35
  "spread_schedules",
33
36
  "archive_schedule_log",
34
37
  "ping_slack",
38
+ "list_schedule_ids",
39
+ "delete_schedule",
40
+ "version",
35
41
  ]
36
42
 
37
43
  parser = argparse.ArgumentParser(
@@ -239,6 +245,39 @@ class Cicada:
239
245
  args = parser.parse_args(sys.argv[2:])
240
246
  ping_slack.main(args.text)
241
247
 
248
+ @staticmethod
249
+ def list_schedule_ids():
250
+ """List schedule ids of all schedules"""
251
+ parser = argparse.ArgumentParser(
252
+ allow_abbrev=False,
253
+ add_help=True,
254
+ prog=inspect.stack()[0][3],
255
+ description="List schedule ids of all schedules",
256
+ )
257
+ if len(sys.argv) >= 3:
258
+ parser.print_help(sys.stdout)
259
+ sys.exit(0)
260
+ list_schedules.main()
261
+
262
+ @staticmethod
263
+ def delete_schedule():
264
+ """Delete a schedule using schedule_id"""
265
+ parser = argparse.ArgumentParser(
266
+ allow_abbrev=False,
267
+ add_help=True,
268
+ prog=inspect.stack()[0][3],
269
+ description="Delete a schedule using schedule_id",
270
+ )
271
+ parser.add_argument("--schedule_id", type=str, required=True, help="Id of the schedule")
272
+ # now that we're inside a subcommand, ignore the first TWO args
273
+ args = parser.parse_args(sys.argv[2:])
274
+ delete_schedule.main(args.schedule_id)
275
+
276
+ @staticmethod
277
+ def version():
278
+ """Return version of cicada package"""
279
+ print(get_distribution("cicada").version)
280
+
242
281
 
243
282
  def main():
244
283
  """Cicada agent CLI."""
@@ -0,0 +1,22 @@
1
+ """Delete a schedule using schedule_id."""
2
+
3
+ import sys
4
+
5
+ from tabulate import tabulate
6
+
7
+ from cicada.lib import postgres
8
+ from cicada.lib import scheduler
9
+ from cicada.lib import utils
10
+
11
+
12
+ @utils.named_exception_handler("delete_schedule")
13
+ def main(schedule_id, dbname=None):
14
+ """Delete a schedule using schedule_id."""
15
+
16
+ db_conn = postgres.db_cicada(dbname)
17
+ db_cur = db_conn.cursor()
18
+ scheduler.delete_schedule(db_cur, str(schedule_id))
19
+ db_cur.close()
20
+ db_conn.close()
21
+
22
+ print("schedule_id '" + str(schedule_id) + "' is deleted!")
@@ -197,7 +197,6 @@ def main(schedule_id, dbname=None):
197
197
  db_conn = postgres.db_cicada(dbname)
198
198
  db_cur = db_conn.cursor()
199
199
  if get_abort_running(db_cur, schedule_id):
200
-
201
200
  # Terminate main process
202
201
  returncode = -15
203
202
  error_detail = "Cicada abort_running"
@@ -0,0 +1,19 @@
1
+ """List all schedule ID's."""
2
+
3
+ from tabulate import tabulate
4
+
5
+ from cicada.lib import postgres
6
+ from cicada.lib import scheduler
7
+ from cicada.lib import utils
8
+
9
+
10
+ @utils.named_exception_handler("list_schedule_ids")
11
+ def main(dbname=None):
12
+ """Show all Cicada schedule ID's."""
13
+ db_conn = postgres.db_cicada(dbname)
14
+ db_cur = db_conn.cursor()
15
+ obj_schedules = scheduler.get_all_schedule_ids(db_cur)
16
+ db_cur.close()
17
+ db_conn.close()
18
+ print("")
19
+ print(tabulate(obj_schedules, headers=["Server ID", "Schedule ID", "Description"]))
@@ -93,7 +93,6 @@ def main(spread_details, dbname=None):
93
93
  last_week_schedules_by_load = get_last_week_schedules_by_load(db_cur, from_server_ids)
94
94
 
95
95
  for schedule_id in last_week_schedules_by_load:
96
-
97
96
  current_schedule_details = scheduler.get_schedule_details(db_cur, schedule_id)
98
97
  new_schedule_details = current_schedule_details.copy()
99
98
  new_schedule_details["server_id"] = valid_target_servers[next_enabled_server]
@@ -28,7 +28,6 @@ def main(schedule_details, dbname=None):
28
28
  current_schedule_details = scheduler.get_schedule_details(db_cur, schedule_details["schedule_id"])
29
29
 
30
30
  if not current_schedule_details:
31
-
32
31
  if schedule_details["interval_mask"] is None:
33
32
  print("ERROR: interval_mask is required for new schedule")
34
33
  sys.exit(1)
@@ -1,4 +1,5 @@
1
1
  """Backend PostgreSQL database library"""
2
+
2
3
  # 2015-07-01 Louis Pieterse
3
4
 
4
5
  import psycopg2
@@ -18,7 +19,7 @@ def db_cicada(dbname=None):
18
19
  user = definitions["db_cicada"]["user"]
19
20
  password = definitions["db_cicada"]["password"]
20
21
 
21
- conn = psycopg2.connect(host=host, port=port, dbname=dbname, user=user, password=password)
22
+ conn = psycopg2.connect(host=host, port=port, dbname=dbname, user=user, password=password, sslmode="prefer")
22
23
  conn.autocommit = True
23
24
 
24
25
  return conn
@@ -25,7 +25,6 @@ def get_host_details():
25
25
  hostname = hostname[: hostname.find(".")]
26
26
 
27
27
  fqdn = socket.getfqdn()
28
-
29
28
  ip4_address = socket.gethostbyname(fqdn)
30
29
 
31
30
  host_details = {"hostname": hostname, "fqdn": fqdn, "ip4_address": ip4_address}
@@ -348,3 +347,17 @@ def get_all_schedules(db_cur, server_id, is_async):
348
347
  obj_schedules.append(schedule_id)
349
348
 
350
349
  return obj_schedules
350
+
351
+
352
+ def get_all_schedule_ids(db_cur):
353
+ sqlquery = "SELECT server_id, schedule_id, schedule_description from schedules"
354
+ db_cur.execute(sqlquery)
355
+ cur_schedules = db_cur
356
+
357
+ schedule_ids = cur_schedules.fetchall()
358
+ return schedule_ids
359
+
360
+
361
+ def delete_schedule(db_cur, schedule_id):
362
+ sqlquery = f"DELETE from schedules WHERE schedule_id = '{schedule_id}'"
363
+ db_cur.execute(sqlquery)
@@ -1,14 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cicada
3
- Version: 0.6.0
3
+ Version: 0.8.2
4
4
  Summary: Lightweight, agent-based, distributed scheduler
5
5
  Home-page: https://github.com/transferwise/cicada
6
6
  Author: Wise
7
7
  Classifier: License :: OSI Approved :: Apache Software License
8
8
  Classifier: Programming Language :: Python :: 3 :: Only
9
9
  Description-Content-Type: text/markdown
10
- Provides-Extra: dev
11
10
  License-File: LICENSE
11
+ Requires-Dist: psycopg2-binary==2.9.*
12
+ Requires-Dist: pyyaml==6.0.*
13
+ Requires-Dist: croniter==2.0.*
14
+ Requires-Dist: tabulate==0.9.*
15
+ Requires-Dist: slack-sdk==3.30.*
16
+ Requires-Dist: backoff==2.2.*
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest==8.2.*; extra == "dev"
19
+ Requires-Dist: pytest-cov==5.0.*; extra == "dev"
20
+ Requires-Dist: pytest-mock==3.14.*; extra == "dev"
21
+ Requires-Dist: black==24.4.*; extra == "dev"
22
+ Requires-Dist: flake8==7.1.*; extra == "dev"
23
+ Requires-Dist: freezegun==1.5.*; extra == "dev"
12
24
 
13
25
  # Cicada scheduler
14
26
 
@@ -12,8 +12,10 @@ cicada.egg-info/requires.txt
12
12
  cicada.egg-info/top_level.txt
13
13
  cicada/commands/__init__.py
14
14
  cicada/commands/archive_schedule_log.py
15
+ cicada/commands/delete_schedule.py
15
16
  cicada/commands/exec_schedule.py
16
17
  cicada/commands/exec_server_schedules.py
18
+ cicada/commands/list_schedules.py
17
19
  cicada/commands/list_server_schedules.py
18
20
  cicada/commands/ping_slack.py
19
21
  cicada/commands/register_server.py
@@ -23,4 +25,10 @@ cicada/commands/upsert_schedule.py
23
25
  cicada/lib/__init__.py
24
26
  cicada/lib/postgres.py
25
27
  cicada/lib/scheduler.py
26
- cicada/lib/utils.py
28
+ cicada/lib/utils.py
29
+ tests/test_functional_archive_logs.py
30
+ tests/test_functional_cli_entrypoint.py
31
+ tests/test_functional_main.py
32
+ tests/test_functional_spread_schedules.py
33
+ tests/test_lib_postgres.py
34
+ tests/test_lib_scheduler.py
@@ -0,0 +1,14 @@
1
+ psycopg2-binary==2.9.*
2
+ pyyaml==6.0.*
3
+ croniter==2.0.*
4
+ tabulate==0.9.*
5
+ slack-sdk==3.30.*
6
+ backoff==2.2.*
7
+
8
+ [dev]
9
+ pytest==8.2.*
10
+ pytest-cov==5.0.*
11
+ pytest-mock==3.14.*
12
+ black==24.4.*
13
+ flake8==7.1.*
14
+ freezegun==1.5.*
@@ -7,7 +7,7 @@ with open("README.md") as f:
7
7
 
8
8
  setup(
9
9
  name="cicada",
10
- version="0.6.0",
10
+ version="0.8.2",
11
11
  description="Lightweight, agent-based, distributed scheduler",
12
12
  long_description=long_description,
13
13
  long_description_content_type="text/markdown",
@@ -18,21 +18,21 @@ setup(
18
18
  "Programming Language :: Python :: 3 :: Only",
19
19
  ],
20
20
  install_requires=[
21
- "psycopg2-binary==2.9.5",
22
- "pyyaml==6.0",
23
- "croniter==1.3",
24
- "tabulate==0.9",
25
- "slack-sdk==3.19",
26
- "backoff==2.2",
21
+ "psycopg2-binary==2.9.*",
22
+ "pyyaml==6.0.*",
23
+ "croniter==2.0.*",
24
+ "tabulate==0.9.*",
25
+ "slack-sdk==3.30.*",
26
+ "backoff==2.2.*",
27
27
  ],
28
28
  extras_require={
29
29
  "dev": [
30
- "pytest==7.3",
31
- "pytest-cov==4.0",
32
- "pytest-mock==3.10",
33
- "black==22.12",
34
- "flake8==6.0",
35
- "freezegun==1.2",
30
+ "pytest==8.2.*",
31
+ "pytest-cov==5.0.*",
32
+ "pytest-mock==3.14.*",
33
+ "black==24.4.*",
34
+ "flake8==7.1.*",
35
+ "freezegun==1.5.*",
36
36
  ]
37
37
  },
38
38
  entry_points={"console_scripts": ["cicada=cicada.cli:main"]},
@@ -0,0 +1,200 @@
1
+ """
2
+ test_functional_archive_logs.py
3
+ Test archiving schedule_log entries into schedule_log_historical
4
+ """
5
+
6
+ from unittest import result
7
+ import pytest
8
+ import os
9
+ import datetime
10
+ import psycopg2
11
+
12
+ from cicada.commands import archive_schedule_log
13
+
14
+
15
+ @pytest.fixture(scope="session", autouse=True)
16
+ def get_env_vars():
17
+ """get_env_vars"""
18
+
19
+ pytest.cicada_home = os.environ.get("CICADA_HOME")
20
+
21
+ pytest.db_host = os.environ.get("DB_POSTGRES_HOST")
22
+ pytest.db_port = os.environ.get("DB_POSTGRES_PORT")
23
+ pytest.db_user = os.environ.get("DB_POSTGRES_USER")
24
+ pytest.db_pass = os.environ.get("DB_POSTGRES_PASS")
25
+
26
+ pytest.db_test = f"pytest_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S_%f')}"
27
+
28
+
29
+ @pytest.fixture()
30
+ def db_setup(get_env_vars):
31
+ """db_setup"""
32
+
33
+ # Create the test_db
34
+ pg_conn = psycopg2.connect(
35
+ host=pytest.db_host,
36
+ port=pytest.db_port,
37
+ user=pytest.db_user,
38
+ password=pytest.db_pass,
39
+ database="postgres",
40
+ )
41
+ pg_conn.autocommit = True
42
+ pg_cur = pg_conn.cursor()
43
+ pg_cur.execute(f"CREATE DATABASE {pytest.db_test}")
44
+
45
+ # Create test_db structure
46
+ test_conn = psycopg2.connect(
47
+ host=pytest.db_host,
48
+ port=pytest.db_port,
49
+ user=pytest.db_user,
50
+ password=pytest.db_pass,
51
+ database=pytest.db_test,
52
+ )
53
+ test_conn.autocommit = True
54
+ test_cur = test_conn.cursor()
55
+ test_cur.execute(open(f"{pytest.cicada_home}/setup/schema.sql", "r", encoding="utf-8").read())
56
+ test_cur.close()
57
+ test_conn.close()
58
+
59
+
60
+ def query_test_db(query):
61
+ """Run and SQL query in a postgres database"""
62
+ rows = []
63
+ conn = psycopg2.connect(
64
+ host=pytest.db_host,
65
+ port=pytest.db_port,
66
+ user=pytest.db_user,
67
+ password=pytest.db_pass,
68
+ database=pytest.db_test,
69
+ )
70
+ conn.set_session(readonly=False, autocommit=True)
71
+
72
+ cur = conn.cursor()
73
+
74
+ cur.execute(query)
75
+
76
+ if cur.rowcount > 0 and cur.description:
77
+ rows = cur.fetchall()
78
+
79
+ cur.close()
80
+ conn.close()
81
+ return rows
82
+
83
+
84
+ def test_test_db_setup(db_setup):
85
+ """test_test_db_setup"""
86
+ query_result = query_test_db("SELECT 1")
87
+
88
+ assert query_result == [(1,)]
89
+
90
+
91
+ def test_create_dummy_servers():
92
+ """test_create_dummy_servers"""
93
+ query_test_db(
94
+ """
95
+ INSERT INTO servers
96
+ (server_id, hostname, fqdn, ip4_address, is_enabled)
97
+ VALUES
98
+ (1, '1', '1', '192.168.0.1', 1)
99
+ ;
100
+ """
101
+ )
102
+
103
+ results = query_test_db(f"SELECT count(*) FROM servers WHERE is_enabled=1")[0][0]
104
+
105
+ assert results == 1
106
+
107
+
108
+ def test_create_dummy_schedules():
109
+ """test_create_dummy_schedules"""
110
+ query_test_db(
111
+ """
112
+ INSERT INTO schedules
113
+ (server_id, schedule_id, interval_mask, exec_command, is_enabled, is_running)
114
+ VALUES
115
+ (1, '1-1', '* * * * *', '1-1', 1, 0)
116
+ ,(1, '1-2', '* * * * *', '1-2', 1, 0)
117
+ ,(1, '1-3', '* * * * *', '1-3', 1, 1)
118
+ ,(1, '1-4', '* * * * *', '1-4', 1, 0)
119
+ ;
120
+ """
121
+ )
122
+
123
+ results = query_test_db(f"SELECT count(*) FROM schedules WHERE is_enabled=1")[0][0]
124
+
125
+ assert results == 4
126
+
127
+
128
+ def test_create_dummy_schedule_logs():
129
+ """test_create_dummy_schedule_logs"""
130
+ query_test_db(
131
+ """
132
+ INSERT INTO schedule_log
133
+ (server_id, schedule_id, full_command, start_time, end_time, returncode)
134
+ VALUES
135
+ (1, '1-1', '1-1', '2022-01-01 01:00:00', '2022-01-01 02:00:00' , 0)
136
+ ,(1, '1-1', '1-1', '2022-01-01 03:00:00', '2022-01-01 04:00:00' , 0)
137
+ ,(1, '1-1', '1-1', '2022-01-01 05:00:00', '2022-01-01 06:00:00' , 0)
138
+ ,(1, '1-1', '1-1', '2022-01-01 07:00:00', '2022-01-01 08:00:00' , 0)
139
+ ,(1, '1-1', '1-1', '2022-01-01 09:00:00', '2022-01-01 10:00:00' , 0)
140
+ ,(1, '1-2', '1-2', '2022-01-01 01:00:00', null , null)
141
+ ,(1, '1-2', '1-2', '2022-01-01 03:00:00', null , null)
142
+ ,(1, '1-2', '1-2', '2022-01-01 04:00:00', null , null)
143
+ ,(1, '1-2', '1-2', '2022-01-01 07:00:00', null , null)
144
+ ,(1, '1-2', '1-2', '2022-01-01 09:00:00', null , null)
145
+ ,(1, '1-3', '1-3', '2022-01-01 01:00:00', null , null)
146
+ ,(1, '1-3', '1-3', '2022-01-01 03:00:00', null , null)
147
+ ,(1, '1-3', '1-3', '2022-01-01 05:00:00', null , null)
148
+ ,(1, '1-3', '1-3', '2022-01-01 07:00:00', null , null)
149
+ ,(1, '1-3', '1-3', '2022-01-01 09:00:00', null , null)
150
+ ;
151
+ """
152
+ )
153
+
154
+ results = query_test_db(f"SELECT count(*) FROM schedule_log")[0][0]
155
+
156
+ assert results == 15
157
+
158
+
159
+ def test_archive_schedules():
160
+ """test_archive_schedules"""
161
+ archive_schedule_log.main(1, pytest.db_test)
162
+
163
+ result = query_test_db(
164
+ f"SELECT (SELECT count(*) FROM schedule_log) || ',' || (SELECT count(*) from schedule_log_historical)"
165
+ )[0][0]
166
+
167
+ assert result == "2,13"
168
+
169
+
170
+ def test_archive_schedule_keep_correct_schedules():
171
+ """test_archive_schedule_keep_correct_schedules"""
172
+
173
+ result = query_test_db(f"SELECT schedule_id, start_time, end_time, returncode FROM schedule_log")
174
+
175
+ assert result == [
176
+ (
177
+ "1-1",
178
+ datetime.datetime(2022, 1, 1, 9, 0),
179
+ datetime.datetime(2022, 1, 1, 10, 0),
180
+ 0,
181
+ ),
182
+ ("1-3", datetime.datetime(2022, 1, 1, 9, 0), None, None),
183
+ ]
184
+
185
+
186
+ def test_db_teardown():
187
+ """test_db_teardown"""
188
+ pg_conn = psycopg2.connect(
189
+ host=pytest.db_host,
190
+ port=pytest.db_port,
191
+ user=pytest.db_user,
192
+ password=pytest.db_pass,
193
+ database="postgres",
194
+ )
195
+ pg_conn.autocommit = True
196
+ pg_cur = pg_conn.cursor()
197
+
198
+ pg_cur.execute(f"DROP DATABASE IF EXISTS {pytest.db_test}")
199
+ pg_cur.close()
200
+ pg_conn.close()