From 0f0d58a94fb17032ef6fe918f8d18e51f9cd8eb6 Mon Sep 17 00:00:00 2001 From: David Yastremsky <58150256+dyastremsky@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:03:58 -0800 Subject: [PATCH] Organize unit tests into directories (#221) --- genai-perf/pytest.ini | 28 +++++++++++++++++++ .../test_create_telemetry_data_collector.py | 0 .../test_telemetry_data_collector.py | 0 .../test_triton_telemetry_data_collector.py | 0 .../test_embeddings_converter.py | 0 .../test_image_retrieval_converter.py | 0 .../test_nvclip_converter.py | 0 .../test_openai_chat_converter.py | 0 .../test_openai_completions_converter.py | 0 .../test_output_format_converter.py | 0 .../test_rankings_converter.py | 0 .../test_tensorrtllm_engine_converter.py | 0 .../test_triton_generate_converter.py | 0 .../test_triton_tensorrtllm_converter.py | 0 .../test_triton_vllm_converter.py | 0 ...est_image_retrieval_profile_data_parser.py | 3 +- .../test_llm_profile_data_parser.py | 3 +- .../test_profile_data_parser.py | 0 .../test_console_exporter.py | 0 .../{ => test_exporters}/test_csv_exporter.py | 0 .../test_data_exporter_factory.py | 0 .../test_json_exporter.py | 0 .../{ => test_metrics}/test_llm_metrics.py | 0 .../tests/{ => test_metrics}/test_metrics.py | 0 .../test_telemetry_metrics.py | 0 .../test_file_input_retriever.py | 0 .../test_input_retriever_factory.py | 0 .../test_synthetic_data_retriever.py | 0 .../test_synthetic_image_generator.py | 0 29 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 genai-perf/pytest.ini rename genai-perf/tests/{ => test_collectors}/test_create_telemetry_data_collector.py (100%) rename genai-perf/tests/{ => test_collectors}/test_telemetry_data_collector.py (100%) rename genai-perf/tests/{ => test_collectors}/test_triton_telemetry_data_collector.py (100%) rename genai-perf/tests/{ => test_converters}/test_embeddings_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_image_retrieval_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_nvclip_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_openai_chat_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_openai_completions_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_output_format_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_rankings_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_tensorrtllm_engine_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_triton_generate_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_triton_tensorrtllm_converter.py (100%) rename genai-perf/tests/{ => test_converters}/test_triton_vllm_converter.py (100%) rename genai-perf/tests/{ => test_data_parser}/test_image_retrieval_profile_data_parser.py (99%) rename genai-perf/tests/{ => test_data_parser}/test_llm_profile_data_parser.py (99%) rename genai-perf/tests/{ => test_data_parser}/test_profile_data_parser.py (100%) rename genai-perf/tests/{ => test_exporters}/test_console_exporter.py (100%) rename genai-perf/tests/{ => test_exporters}/test_csv_exporter.py (100%) rename genai-perf/tests/{ => test_exporters}/test_data_exporter_factory.py (100%) rename genai-perf/tests/{ => test_exporters}/test_json_exporter.py (100%) rename genai-perf/tests/{ => test_metrics}/test_llm_metrics.py (100%) rename genai-perf/tests/{ => test_metrics}/test_metrics.py (100%) rename genai-perf/tests/{ => test_metrics}/test_telemetry_metrics.py (100%) rename genai-perf/tests/{ => test_retrievers}/test_file_input_retriever.py (100%) rename genai-perf/tests/{ => test_retrievers}/test_input_retriever_factory.py (100%) rename genai-perf/tests/{ => test_retrievers}/test_synthetic_data_retriever.py (100%) rename genai-perf/tests/{ => test_retrievers}/test_synthetic_image_generator.py (100%) diff --git a/genai-perf/pytest.ini b/genai-perf/pytest.ini new file mode 100644 index 00000000..b2a17fd4 --- /dev/null +++ b/genai-perf/pytest.ini @@ -0,0 +1,28 @@ +# Copyright 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of NVIDIA CORPORATION nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[pytest] +pythonpath = tests diff --git a/genai-perf/tests/test_create_telemetry_data_collector.py b/genai-perf/tests/test_collectors/test_create_telemetry_data_collector.py similarity index 100% rename from genai-perf/tests/test_create_telemetry_data_collector.py rename to genai-perf/tests/test_collectors/test_create_telemetry_data_collector.py diff --git a/genai-perf/tests/test_telemetry_data_collector.py b/genai-perf/tests/test_collectors/test_telemetry_data_collector.py similarity index 100% rename from genai-perf/tests/test_telemetry_data_collector.py rename to genai-perf/tests/test_collectors/test_telemetry_data_collector.py diff --git a/genai-perf/tests/test_triton_telemetry_data_collector.py b/genai-perf/tests/test_collectors/test_triton_telemetry_data_collector.py similarity index 100% rename from genai-perf/tests/test_triton_telemetry_data_collector.py rename to genai-perf/tests/test_collectors/test_triton_telemetry_data_collector.py diff --git a/genai-perf/tests/test_embeddings_converter.py b/genai-perf/tests/test_converters/test_embeddings_converter.py similarity index 100% rename from genai-perf/tests/test_embeddings_converter.py rename to genai-perf/tests/test_converters/test_embeddings_converter.py diff --git a/genai-perf/tests/test_image_retrieval_converter.py b/genai-perf/tests/test_converters/test_image_retrieval_converter.py similarity index 100% rename from genai-perf/tests/test_image_retrieval_converter.py rename to genai-perf/tests/test_converters/test_image_retrieval_converter.py diff --git a/genai-perf/tests/test_nvclip_converter.py b/genai-perf/tests/test_converters/test_nvclip_converter.py similarity index 100% rename from genai-perf/tests/test_nvclip_converter.py rename to genai-perf/tests/test_converters/test_nvclip_converter.py diff --git a/genai-perf/tests/test_openai_chat_converter.py b/genai-perf/tests/test_converters/test_openai_chat_converter.py similarity index 100% rename from genai-perf/tests/test_openai_chat_converter.py rename to genai-perf/tests/test_converters/test_openai_chat_converter.py diff --git a/genai-perf/tests/test_openai_completions_converter.py b/genai-perf/tests/test_converters/test_openai_completions_converter.py similarity index 100% rename from genai-perf/tests/test_openai_completions_converter.py rename to genai-perf/tests/test_converters/test_openai_completions_converter.py diff --git a/genai-perf/tests/test_output_format_converter.py b/genai-perf/tests/test_converters/test_output_format_converter.py similarity index 100% rename from genai-perf/tests/test_output_format_converter.py rename to genai-perf/tests/test_converters/test_output_format_converter.py diff --git a/genai-perf/tests/test_rankings_converter.py b/genai-perf/tests/test_converters/test_rankings_converter.py similarity index 100% rename from genai-perf/tests/test_rankings_converter.py rename to genai-perf/tests/test_converters/test_rankings_converter.py diff --git a/genai-perf/tests/test_tensorrtllm_engine_converter.py b/genai-perf/tests/test_converters/test_tensorrtllm_engine_converter.py similarity index 100% rename from genai-perf/tests/test_tensorrtllm_engine_converter.py rename to genai-perf/tests/test_converters/test_tensorrtllm_engine_converter.py diff --git a/genai-perf/tests/test_triton_generate_converter.py b/genai-perf/tests/test_converters/test_triton_generate_converter.py similarity index 100% rename from genai-perf/tests/test_triton_generate_converter.py rename to genai-perf/tests/test_converters/test_triton_generate_converter.py diff --git a/genai-perf/tests/test_triton_tensorrtllm_converter.py b/genai-perf/tests/test_converters/test_triton_tensorrtllm_converter.py similarity index 100% rename from genai-perf/tests/test_triton_tensorrtllm_converter.py rename to genai-perf/tests/test_converters/test_triton_tensorrtllm_converter.py diff --git a/genai-perf/tests/test_triton_vllm_converter.py b/genai-perf/tests/test_converters/test_triton_vllm_converter.py similarity index 100% rename from genai-perf/tests/test_triton_vllm_converter.py rename to genai-perf/tests/test_converters/test_triton_vllm_converter.py diff --git a/genai-perf/tests/test_image_retrieval_profile_data_parser.py b/genai-perf/tests/test_data_parser/test_image_retrieval_profile_data_parser.py similarity index 99% rename from genai-perf/tests/test_image_retrieval_profile_data_parser.py rename to genai-perf/tests/test_data_parser/test_image_retrieval_profile_data_parser.py index dceefef9..fc2c6ecf 100644 --- a/genai-perf/tests/test_image_retrieval_profile_data_parser.py +++ b/genai-perf/tests/test_data_parser/test_image_retrieval_profile_data_parser.py @@ -32,8 +32,7 @@ import pytest from genai_perf.metrics import ImageRetrievalMetrics, Statistics from genai_perf.profile_data_parser import ImageRetrievalProfileDataParser - -from .test_utils import check_statistics, ns_to_sec +from tests.test_utils import check_statistics, ns_to_sec def check_image_retrieval_metrics( diff --git a/genai-perf/tests/test_llm_profile_data_parser.py b/genai-perf/tests/test_data_parser/test_llm_profile_data_parser.py similarity index 99% rename from genai-perf/tests/test_llm_profile_data_parser.py rename to genai-perf/tests/test_data_parser/test_llm_profile_data_parser.py index 04891b3d..383a3d30 100644 --- a/genai-perf/tests/test_llm_profile_data_parser.py +++ b/genai-perf/tests/test_data_parser/test_llm_profile_data_parser.py @@ -34,8 +34,7 @@ from genai_perf.profile_data_parser import LLMProfileDataParser from genai_perf.record.types.request_throughput_avg import RequestThroughputAvg from genai_perf.tokenizer import DEFAULT_TOKENIZER, get_tokenizer - -from .test_utils import check_statistics, ns_to_sec +from tests.test_utils import check_statistics, ns_to_sec def check_llm_metrics(m1: LLMMetrics, m2: LLMMetrics) -> None: diff --git a/genai-perf/tests/test_profile_data_parser.py b/genai-perf/tests/test_data_parser/test_profile_data_parser.py similarity index 100% rename from genai-perf/tests/test_profile_data_parser.py rename to genai-perf/tests/test_data_parser/test_profile_data_parser.py diff --git a/genai-perf/tests/test_console_exporter.py b/genai-perf/tests/test_exporters/test_console_exporter.py similarity index 100% rename from genai-perf/tests/test_console_exporter.py rename to genai-perf/tests/test_exporters/test_console_exporter.py diff --git a/genai-perf/tests/test_csv_exporter.py b/genai-perf/tests/test_exporters/test_csv_exporter.py similarity index 100% rename from genai-perf/tests/test_csv_exporter.py rename to genai-perf/tests/test_exporters/test_csv_exporter.py diff --git a/genai-perf/tests/test_data_exporter_factory.py b/genai-perf/tests/test_exporters/test_data_exporter_factory.py similarity index 100% rename from genai-perf/tests/test_data_exporter_factory.py rename to genai-perf/tests/test_exporters/test_data_exporter_factory.py diff --git a/genai-perf/tests/test_json_exporter.py b/genai-perf/tests/test_exporters/test_json_exporter.py similarity index 100% rename from genai-perf/tests/test_json_exporter.py rename to genai-perf/tests/test_exporters/test_json_exporter.py diff --git a/genai-perf/tests/test_llm_metrics.py b/genai-perf/tests/test_metrics/test_llm_metrics.py similarity index 100% rename from genai-perf/tests/test_llm_metrics.py rename to genai-perf/tests/test_metrics/test_llm_metrics.py diff --git a/genai-perf/tests/test_metrics.py b/genai-perf/tests/test_metrics/test_metrics.py similarity index 100% rename from genai-perf/tests/test_metrics.py rename to genai-perf/tests/test_metrics/test_metrics.py diff --git a/genai-perf/tests/test_telemetry_metrics.py b/genai-perf/tests/test_metrics/test_telemetry_metrics.py similarity index 100% rename from genai-perf/tests/test_telemetry_metrics.py rename to genai-perf/tests/test_metrics/test_telemetry_metrics.py diff --git a/genai-perf/tests/test_file_input_retriever.py b/genai-perf/tests/test_retrievers/test_file_input_retriever.py similarity index 100% rename from genai-perf/tests/test_file_input_retriever.py rename to genai-perf/tests/test_retrievers/test_file_input_retriever.py diff --git a/genai-perf/tests/test_input_retriever_factory.py b/genai-perf/tests/test_retrievers/test_input_retriever_factory.py similarity index 100% rename from genai-perf/tests/test_input_retriever_factory.py rename to genai-perf/tests/test_retrievers/test_input_retriever_factory.py diff --git a/genai-perf/tests/test_synthetic_data_retriever.py b/genai-perf/tests/test_retrievers/test_synthetic_data_retriever.py similarity index 100% rename from genai-perf/tests/test_synthetic_data_retriever.py rename to genai-perf/tests/test_retrievers/test_synthetic_data_retriever.py diff --git a/genai-perf/tests/test_synthetic_image_generator.py b/genai-perf/tests/test_retrievers/test_synthetic_image_generator.py similarity index 100% rename from genai-perf/tests/test_synthetic_image_generator.py rename to genai-perf/tests/test_retrievers/test_synthetic_image_generator.py