lms.cli.lib.generate-test-data

Generate test data by starting the specified server and running all tests in this project.

usage: python3 -m lms.cli.lib.generate-test-data [-h] [--version]
                                                 [--server-output-file SERVER_OUTPUT_PATH]
                                                 [--server-stop-command SERVER_STOP_COMMAND]
                                                 [--startup-skip-identify]
                                                 [--startup-wait STARTUP_WAIT_SECS]
                                                 RUN_SERVER_COMMAND

Generate test data by starting the specified server and running all tests in
this project.

positional arguments:
  RUN_SERVER_COMMAND    The command to run the LMS server that will be the
                        target of the data generation commands.

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

server control:
  --server-output-file SERVER_OUTPUT_PATH
                        Where server output will be written. Defaults to a
                        random temp file.
  --server-stop-command SERVER_STOP_COMMAND
                        An optional command to stop the server. After this the
                        server will be sent a SIGINT and then a SIGKILL.
  --startup-skip-identify
                        If set, startup will skip trying to identify the
                        server as a means of checking that the server is
                        started.
  --startup-wait STARTUP_WAIT_SECS
                        The time to wait between starting the server and
                        sending commands (default: 10.0).
 1# pylint: disable=invalid-name
 2
 3"""
 4Generate test data by starting the specified server and running all tests in this project.
 5"""
 6
 7import argparse
 8import sys
 9
10import edq.testing.serverrunner
11
12import lms.cli.parser
13import lms.testing.testdata
14
15def run_cli(args: argparse.Namespace) -> int:
16    """ Run the CLI. """
17
18    return lms.testing.testdata.generate(args)
19
20def main() -> int:
21    """ Get a parser, parse the args, and call run. """
22    return run_cli(_get_parser().parse_args())
23
24def _get_parser() -> argparse.ArgumentParser:
25    """ Get the parser. """
26
27    parser = lms.cli.parser.get_parser(__doc__.strip(),
28            include_server = False,
29            include_auth = False,
30    )
31
32    edq.testing.serverrunner.modify_parser(parser)
33
34    return parser
35
36if (__name__ == '__main__'):
37    sys.exit(main())
def run_cli(args: argparse.Namespace) -> int:
16def run_cli(args: argparse.Namespace) -> int:
17    """ Run the CLI. """
18
19    return lms.testing.testdata.generate(args)

Run the CLI.

def main() -> int:
21def main() -> int:
22    """ Get a parser, parse the args, and call run. """
23    return run_cli(_get_parser().parse_args())

Get a parser, parse the args, and call run.