|
| 1 | +from planemo.database.postgres_docker import stop_postgres_docker |
1 | 2 | from .test_utils import ( |
2 | 3 | CliTestCase, |
3 | 4 | skip_unless_environ, |
| 5 | + skip_unless_executable, |
4 | 6 | ) |
5 | 7 |
|
6 | 8 |
|
7 | 9 | class DatabaseCommandsTestCase(CliTestCase): |
8 | 10 |
|
9 | 11 | @skip_unless_environ("PLANEMO_ENABLE_POSTGRES_TESTS") |
10 | | - def test_database_commands(self): |
| 12 | + def _database_commands(self, database_type="postgres"): |
11 | 13 | with self._isolate(): |
12 | 14 | result = self._check_exit_code(["database_list"]) |
13 | 15 | assert "test1234" not in result.output |
14 | | - self._check_exit_code(["database_create", "test1234"]) |
| 16 | + self._check_exit_code(["database_create", "test1234", "--database_type", database_type]) |
15 | 17 | result = self._check_exit_code(["database_list"]) |
16 | 18 | assert "test1234" in result.output |
17 | 19 | self._check_exit_code(["database_delete", "test1234"]) |
18 | 20 | result = self._check_exit_code(["database_list"]) |
19 | 21 | assert "test1234" not in result.output |
| 22 | + |
| 23 | + @skip_unless_environ("PLANEMO_ENABLE_POSTGRES_TESTS") |
| 24 | + @skip_unless_executable("psql") |
| 25 | + def test_database_commands(self): |
| 26 | + self._database_commands() |
| 27 | + |
| 28 | + @skip_unless_executable("docker") |
| 29 | + def test_database_commands_docker(self): |
| 30 | + try: |
| 31 | + self._database_commands(database_type="postgres_docker") |
| 32 | + finally: |
| 33 | + stop_postgres_docker() |
0 commit comments