From 0c7402102f015ffe6d7032ba7a96b79fd8eef92e Mon Sep 17 00:00:00 2001 From: Brian Gunnarson Date: Fri, 13 Sep 2024 13:16:21 -0700 Subject: [PATCH] update the temp_output_directory to include python version --- tests/conftest.py | 5 ++++- tests/context_managers/celery_workers_manager.py | 2 +- tests/context_managers/server_manager.py | 2 +- tests/unit/common/test_sample_index.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2a4b5f16..11bd9313 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -31,6 +31,7 @@ This module contains pytest fixtures to be used throughout the entire test suite. """ import os +import sys from copy import copy from glob import glob from time import sleep @@ -110,7 +111,9 @@ def temp_output_dir(tmp_path_factory: TempPathFactory) -> str: """ # Log the cwd, then create and move into the temporary one cwd = os.getcwd() - temp_integration_outfile_dir = tmp_path_factory.mktemp("integration_outfiles_") + temp_integration_outfile_dir = tmp_path_factory.mktemp( + f"python_{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}_" + ) os.chdir(temp_integration_outfile_dir) yield temp_integration_outfile_dir diff --git a/tests/context_managers/celery_workers_manager.py b/tests/context_managers/celery_workers_manager.py index 0acdee13..118aa21a 100644 --- a/tests/context_managers/celery_workers_manager.py +++ b/tests/context_managers/celery_workers_manager.py @@ -135,7 +135,7 @@ def start_worker(self, worker_launch_cmd: List[str]): app.worker_main instead of the normal "celery -A worker" command to launch the workers since our celery app is created in a pytest fixture and is unrecognizable by the celery command. For each worker, the output of it's logs are sent to - /tmp/`whoami`/pytest-of-`whoami`/pytest-current/integration_outfiles_current/ under a file with a name + /tmp/`whoami`/pytest-of-`whoami`/pytest-current/python_{major}.{minor}.{micro}_current/ under a file with a name similar to: test_worker_*.log. NOTE: pytest-current/ will have the results of the most recent test run. If you want to see a previous run check under pytest-/. HOWEVER, only the 3 most recent test runs will be saved. diff --git a/tests/context_managers/server_manager.py b/tests/context_managers/server_manager.py index c8894877..b99afb2c 100644 --- a/tests/context_managers/server_manager.py +++ b/tests/context_managers/server_manager.py @@ -56,7 +56,7 @@ def __exit__(self, exc_type: Type[Exception], exc_value: Exception, traceback: T def initialize_server(self): """ Initialize the setup for the local redis server. We'll write the folder to: - /tmp/`whoami`/pytest-of-`whoami`/pytest-current/integration_outfiles_current/ + /tmp/`whoami`/pytest-of-`whoami`/pytest-current/python_{major}.{minor}.{micro}_current/ We'll set the password to be 'merlin-test-server' so it'll be easy to shutdown if necessary """ subprocess.run( diff --git a/tests/unit/common/test_sample_index.py b/tests/unit/common/test_sample_index.py index d857b7ce..c9cd108e 100644 --- a/tests/unit/common/test_sample_index.py +++ b/tests/unit/common/test_sample_index.py @@ -80,7 +80,7 @@ class TestSampleIndex: NOTE to see output of creating any hierarchy, change `write_all_hierarchies` to True. The results of each hierarchy will be written to: - /tmp/`whoami`/pytest/pytest-of-`whoami`/pytest-current/integration_outfiles_current/test_sample_index/ + /tmp/`whoami`/pytest/pytest-of-`whoami`/pytest-current/python_{major}.{minor}.{micro}_current/test_sample_index/ """ write_all_hierarchies = False