viash ns test

Test a namespace containing many viash config files.


viash ns test [-n nmspc] [-s src] [-p docker] [--parallel] [--tsv file.tsv] [--append]


-a, --append

Append to tsv instead of overwrite

-c, --config_mod

Modify a viash config at runtime using a custom DSL.

-k, --keep

Whether or not to keep temporary files. By default, files will be deleted if all goes well but remain when an error occurs. By specifying --keep true, the temporary files will always be retained, whereas --keep false will always delete them. The temporary directory can be overwritten by setting defining a VIASH_TEMP directory.

-l, --parallel

Whether or not to run the process in parallel.

-p, --platform

Acts as a regular expression to filter the platform ids specified in the found config files. If this is not provided, all platforms will be used. If no platforms are defined in a config, the native platform will be used. In addition, the path to a platform yaml file can also be specified.

-q, --query

Filter which components get selected by name and namespace. Can be a regex. Example: “^mynamespace/component1$”.


Filter which components get selected by name. Can be a regex. Example: “^component1”.

-n, --query_namespace

Filter which namespaces get selected by namespace. Can be a regex. Example: “^mynamespace$”.

-s, --src

A source directory containing viash config files, possibly structured in a hierarchical folder structure. Default: src/.

-t, --tsv

Path to write a summary of the test results to.

-h, --help

Show help message


Testing with no arguments

When no arguments are given. All components in a subdirectory named src are tested. This includes testing if a component can be built and any tests defined in its config file. See Namespaces for an overview of how you should structure your components for this to work correctly.

viash ns test

After running this command, a test report is printed to the terminal with the results.

Specifying a source folder and a namespace

In order for namespace querying to work, make sure your config files include a namespace field. The command below searches the my_components_dir directory for all Viash components in the my_namespace namespace and tests them.

viash ns test --src 'my_components_dir' --query_namespace 'my_namespace'

Filter a specific component to test

This tests any Viash components where the name contains “parse”:

viash ns test --query_name  "parse"

Test a specific platform

This runs a test on all components that utilises the Docker backend:

viash ns test --platform docker

Run the tests in parallel

By default, the testing of namespaces is a serial process, meaning every components gets tested one by one. With the --parallel option, you can run the process in parallel, allowing you to test all of the components at the same time, potentially saving you a lot of time:

viash ns test --parallel

Save the test results in a file

You can export the test results to a tab-seperated values (TSV) file with the --tsv option. In the example below, a file named report.tsv gets generated.

viash ns test --tsv "report.tsv"

See also