docker/conftest: Fix some docker_compose fixture teardown issues
-
Use an exit handler to guarantee current compose session will be teardowned when any keyboard interruption or unhandled exception occurs when running tests.
-
If multiple test suites failed, the log directory is attempted to be created multiple times. But as we use tmp_path_factory.mktemp with the numbered parameter set to False (to ensure all logs are dumped in a same directory), an exception is raised after a second test suite fails as the log directory already exists. So check if the log directory exists before creating it.