Repository: exasol/integration-test-docker-environment (language: python)

Issue:
Fix output of test DockerTestEnvironmentDockerRuntimeInvalidRuntimeGivenTest
## Background

The test DockerTestEnvironmentDockerRuntimeInvalidRuntimeGivenTest aims to verify that the test environment can't be started with an invalud docker runtime. In the expected behavior it will not create the class variable `spawned_docker_test_environments`. However during the `teardown` of the test we still try to close the test envirnment referenced by `spawned_docker_test_environments`, which is expected to fail and raise an exception. This exception is printed out and pollutes the log of the test.

## Acceptance

Avoid printing the exception if it's the expected exception.
Move implementations of all click commands in separate methods
## Background

Similar to https://github.com/exasol/script-languages-container-tool/pull/162 we need to separate click commands and implementation. This provides an access to ITDE functions from other Python libraries (and not only via CLI as now)

## Acceptance Criteria

Add a new API layer  


Discussion / hints:

Fix patch:
diff --git a/doc/changes/changes_0.12.0.md b/doc/changes/changes_0.12.0.md
index 292b72924..325c301e1 100644
--- a/doc/changes/changes_0.12.0.md
+++ b/doc/changes/changes_0.12.0.md
@@ -20,6 +20,7 @@ TBD
 ## Bug Fixes:
 - #228: Fixed graph plot generator
 - #230: Fixed default value of click option external-exasol-xmlrpc-port should be int
+- #211: Fixed output of test DockerTestEnvironmentDockerRuntimeInvalidRuntimeGivenTest
 
 ## Features / Enhancements:
 


Test patch:
diff --git a/exasol_integration_test_docker_environment/test/test_test_environment_docker_runtime.py b/exasol_integration_test_docker_environment/test/test_test_environment_docker_runtime.py
index 378da389f..99f7c172b 100644
--- a/exasol_integration_test_docker_environment/test/test_test_environment_docker_runtime.py
+++ b/exasol_integration_test_docker_environment/test/test_test_environment_docker_runtime.py
@@ -1,3 +1,4 @@
+import subprocess
 import unittest
 
 from exasol_integration_test_docker_environment.lib.docker import ContextDockerClient
@@ -135,29 +136,28 @@ def setUpClass(cls):
                 cls,
                 utils.INTEGRATION_TEST_DOCKER_ENVIRONMENT_DEFAULT_BIN,
                 clean_images_at_close=False)
-        cls.default_docker_runtime = get_default_docker_runtime()
         cls.docker_environment_name = "test_default_runtime_given"
-        cls.docker_environments = ()
-        try:
-            cls.spawned_docker_test_environments = cls.test_environment.spawn_docker_test_environments(
-                    cls.docker_environment_name,
-                    additional_parameter=[
-                        "--docker-runtime", "AAAABBBBCCCC_INVALID_RUNTIME_111122223333",
-                        "--deactivate-database-setup",
-                    ])
-        except Exception as e:
-            pass
 
     @classmethod
     def tearDownClass(cls):
-        try:
-            utils.close_environments(cls.spawned_docker_test_environments)
-        except Exception as e:
-            print(e)
         utils.close_environments(cls.test_environment)
 
     def test_docker_environment_not_available(self):
-        self.assertFalse("spawned_docker_test_environments" in self.__dict__)
+        exception_thrown = False
+        spawn_docker_test_environments_successful = False
+        try:
+            spawned_docker_test_environments = self.test_environment.spawn_docker_test_environments(
+                    self.docker_environment_name,
+                    additional_parameter=[
+                        "--docker-runtime", "AAAABBBBCCCC_INVALID_RUNTIME_111122223333",
+                        "--deactivate-database-setup",
+                    ])
+            spawn_docker_test_environments_successful = True
+            utils.close_environments(spawned_docker_test_environments)
+        except subprocess.CalledProcessError:
+            exception_thrown = True
+        self.assertFalse(spawn_docker_test_environments_successful)
+        self.assertTrue(exception_thrown)
 
 
 if __name__ == '__main__':