Utils

CMake

class tests.utils.test_cmake.TestFileAPIView on GitHub

Bases: object

Tests for reprospect.utils.cmake.FileAPI.

cmake_file_api() FileAPIView on GitHub
test_cache(cmake_file_api: FileAPI) NoneView on GitHub

Check that cache variables are read correctly.

test_codemodel_configuration(cmake_file_api: FileAPI) NoneView on GitHub

Check codemodel configuration information.

test_target(cmake_file_api: FileAPI) NoneView on GitHub

Check target information.

test_toolchains(cmake_file_api: FileAPI) NoneView on GitHub

Check toolchain information.

Compile command

class tests.utils.test_compile_command.TestGetArchFromCompileCommandView on GitHub

Bases: object

Tests for reprospect.utils.compile_command.get_arch_from_compile_command().

test_from_bits() NoneView on GitHub
test_from_compile_commands_json(cmake_file_api) NoneView on GitHub
tests.utils.test_compile_command.cmake_file_api() FileAPIView on GitHub

Detect GPUs

class tests.utils.test_detect.TestGPUDetectorView on GitHub

Bases: object

Tests for reprospect.utils.detect.GPUDetector.

OUTPUT = b'index, uuid, name, compute_cap\n0, GPU-12345678-1234-1234-1234-123456789012, NVIDIA GeForce RTX 3090, 8.6\n1, GPU-87654321-4321-4321-4321-210987654321, NVIDIA A100-SXM4-40GB, 8.0\n'
test_detect_gpus() NoneView on GitHub

Test that reprospect.utils.detect.GPUDetector.get() returns a properly formatted pandas.DataFrame.

test_detect_gpus_cache() NoneView on GitHub

Test that calling reprospect.utils.detect.GPUDetector.get() twice uses caching and only calls nvidia-smi once.

test_detect_gpus_no_cache() NoneView on GitHub

Test that calling reprospect.utils.detect.GPUDetector.get() twice when caching is disabled calls nvidia-smi twice.

test_detect_gpus_no_gpu() NoneView on GitHub

Test that reprospect.utils.detect.GPUDetector.get() returns an empty pandas.DataFrame if nvidia-smi is not found.

class tests.utils.test_detect.TestGPUDetectorAsScriptView on GitHub

Bases: object

Tests for reprospect.utils.detect in script mode.

SCRIPT: Final[str] = '/__w/reprospect/reprospect/reprospect/utils/detect.py'
test(capsys) NoneView on GitHub

Check that the output is correctly formatted according to the arguments.

subprocess

class tests.utils.test_subprocess_helpers.TestPopenStreamView on GitHub

Bases: object

Tests for reprospect.utils.subprocess_helpers.popen_stream.

static mocker(*, wait: int, stdout: str | None = None, stderr: str | None = None) MagicMockView on GitHub
test_command_failure() NoneView on GitHub

The command fails.

test_command_not_found() NoneView on GitHub

The command is not found.

test_empty_output() NoneView on GitHub

Empty stdout.

test_generator_break(caplog) NoneView on GitHub

Break while the generator is not finished.

test_lazy() NoneView on GitHub

Use an iterator to read line-by-line.

test_path() NoneView on GitHub

The command contains pathlib.Path.

test_str() NoneView on GitHub

The command is composed of strings.