Skip to content

testing

Testing module

Testing framework main functionalities.

Attributes

console module-attribute

Python
console = Console(soft_wrap=True, force_terminal=True, color_system='truecolor')

Classes

Functions:

test_session

Python
test_session(params: TestParams, sensor: str, test_name: str, output_dir: Path, graphs: bool, cli: bool) -> bool

Executing SCT single test using API interface.

Parameters:

Name Type Description Default
params TestParams

sct input params for the current test

required
sensor str

sensor name

required
test_name str

name of the test

required
output_dir Path

output directory where to save the results

required
graphs bool

flag to enable graphs generation

required
cli bool

flag to enable cli usage instead of api

required

Returns:

Type Description
bool

True if passed, else False

run_tests

Python
run_tests(registry_path: str | Path, output_dir: str | Path, graphs: bool = False, cli: bool = False) -> dict

Running all the SCT Integration Tests from input registry

Parameters:

Name Type Description Default
registry_path str | Path

Path to the integration tests registry .json

required
output_dir str | Path

Path to the output directory where to save results

required
graphs bool

flag to enable graphs generation, by default False

False
cli bool

flag to enable cli usage instead of api, by default False

False

summary_results

Python
summary_results(results: dict) -> bool

Summary of tests results.

Parameters:

Name Type Description Default
results dict

results coming from run_test function

required

Returns:

Type Description
bool

True if all tests are passed, else False

print_dict_as_table

Python
print_dict_as_table(data: dict, title: str = 'Data')

Printing summary results by sensor as a Rich Table.

status_to_color

Python
status_to_color(value: bool) -> str

Command Line Interface for SCT Testing feature.

Attributes

testing_app module-attribute

Python
testing_app = typer.Typer(help='SCT Testing Interface.', context_settings={'help_option_names': ['-h', '--help']})

RegistryOption module-attribute

Python
RegistryOption = Path

CLIOption module-attribute

Python
CLIOption = bool

OutputDirectoryOption1 module-attribute

Python
OutputDirectoryOption1 = Path | None

Functions:

integration_testing

Python
integration_testing(registry: RegistryOption, output_directory: OutputDirectoryOption1, cli: CLIOption = False, graphs: GraphsOption = False) -> None

Run SCT integration tests procedure from registry.

Supported Analyses Executor

Attributes

Classes

Functions:

execute_analysis_test

Python
execute_analysis_test(test_params: TestParams, output_dir: Path, graphs: bool = False, cli: bool = False) -> None

Analysis execution function for testing module.

Parameters:

Name Type Description Default
test_params TestParams

test parameters

required
output_dir Path

output directory

required
graphs bool

flag to enable graphs generation, by default False

False
cli bool

flag to enable cli usage instead of api, by default False

False

Raises:

Type Description
ValueError

unsupported analysis type

SCT Testing - Common Utilities

Attributes

__test__ module-attribute

Python
__test__ = False

runner module-attribute

Python
runner = CliRunner()

Classes

TestOutput dataclass

Test output definition

Attributes

__test__ class-attribute instance-attribute
Python
__test__ = False
csv_results class-attribute instance-attribute
Python
csv_results: Path | None = None
netcdf_results class-attribute instance-attribute
Python
netcdf_results: Path | None = None

Methods:

__init__
Python
__init__(csv_results: Path | None = None, netcdf_results: Path | None = None) -> None

ReferenceOutput dataclass

Reference output definition

Attributes

__test__ class-attribute instance-attribute
Python
__test__ = False
csv_reference class-attribute instance-attribute
Python
csv_reference: Path | None = None
netcdf_reference class-attribute instance-attribute
Python
netcdf_reference: Path | None = None

Methods:

__init__
Python
__init__(csv_reference: Path | None = None, netcdf_reference: Path | None = None) -> None

TestParams dataclass

Attributes

__test__ class-attribute instance-attribute
Python
__test__ = False

Tests input parameters setup

analysis class-attribute instance-attribute
Python
analysis: str | None = None
product class-attribute instance-attribute
Python
product: Path | list[Path] | None = None
config class-attribute instance-attribute
Python
config: Path | None = None
targets class-attribute instance-attribute
Python
targets: Path | None = None
external_orbit class-attribute instance-attribute
Python
external_orbit: Path | None = None
antenna_pattern class-attribute instance-attribute
Python
antenna_pattern: Path | None = None
reference_output class-attribute instance-attribute
Python
reference_output: ReferenceOutput | None = None
external_corrections_product class-attribute instance-attribute
Python
external_corrections_product: Path | None = None
ionospheric_maps class-attribute instance-attribute
Python
ionospheric_maps: Path | None = None
tropospheric_maps class-attribute instance-attribute
Python
tropospheric_maps: Path | None = None

Methods:

__init__
Python
__init__(analysis: str | None = None, product: Path | list[Path] | None = None, config: Path | None = None, targets: Path | None = None, external_orbit: Path | None = None, antenna_pattern: Path | None = None, reference_output: ReferenceOutput | None = None, external_corrections_product: Path | None = None, ionospheric_maps: Path | None = None, tropospheric_maps: Path | None = None) -> None
from_dict classmethod
Python
from_dict(arg: dict) -> TestParams

Composing TestParams dataclass from config dict.

Parameters:

Name Type Description Default
arg dict

input dictionary

required

Returns:

Type Description
TestParams

dataclass

Functions:

cli_launcher

Python
cli_launcher(cli_args: list[str]) -> None