swh.vulns.pytest_plugin module#

class swh.vulns.pytest_plugin.VulnsServerProcess(config, *args, **kwargs)[source]#

Bases: ForkServerProcess

run()[source]#

Method to be run in sub-process; can be overridden in sub-class

start(*args, **kwargs)[source]#

Start child process

class swh.vulns.pytest_plugin.StatsdServer[source]#

Bases: object

new_datagram#

Woken up every time a datagram is added to self.datagrams.

close()[source]#
swh.vulns.pytest_plugin.vulns_statsd_server()[source]#
swh.vulns.pytest_plugin.vulns_test_data_dir(tmp_path_factory) Path[source]#

Creates an empty directory where to write the fixtures’ data

swh.vulns.pytest_plugin.vulns_test_db(vulns_test_data_dir: Path) Path[source]#
swh.vulns.pytest_plugin.vulns_test_data(vulns_test_data_dir, vulns_test_db) Iterator[Path][source]#
swh.vulns.pytest_plugin.vulns_grpc_server_implementation(request)[source]#

Returns "naive". This can be overridden in tests that want to test the Rust implementation by returning "rust".

swh.vulns.pytest_plugin.naive_vulns_server_data() List[DetectedVulnerability][source]#

Data served by the swh.vulns.naive_server.NaiveVulnerabilityServicer spawned by the spawn_naive_grpc_server() fixture

swh.vulns.pytest_plugin.vulns_grpc_server_config(vulns_test_db, vulns_statsd_server, vulns_grpc_server_implementation, request)[source]#
swh.vulns.pytest_plugin.vulns_grpc_server_process(vulns_grpc_server_config, vulns_grpc_server_implementation, vulns_statsd_server, request)[source]#
swh.vulns.pytest_plugin.vulns_grpc_server_started(vulns_grpc_server_process)[source]#
swh.vulns.pytest_plugin.vulns_grpc_stub(vulns_grpc_server)[source]#
swh.vulns.pytest_plugin.vulns_grpc_server(vulns_grpc_server_started: VulnsServerProcess)[source]#
swh.vulns.pytest_plugin.vulns_grpc_server_port(vulns_grpc_server_started: VulnsServerProcess) Iterator[int][source]#

Runs a gRPC server with the data configured via naive_vulns_server_data(). Returns the port it is listening on