Main Functions¶
-
distest.
run_command_line_bot
(target, token, tests, channel_id, stats, collector, timeout)[source]¶ Start the bot in command-line mode. The program will exit 1 if any of the tests failed.
Relies on
run_dtest_bot()
to parse the command line arguments and pass them here. Not really meant to be called by the user.- Parameters
target (str) – The display name of the bot we are testing.
token (str) – The tester’s token, used to log in.
tests (str) – List of tests to run.
channel_id (int) – The ID of the channel in which to run the tests.
stats (bool) – Determines whether or not to display stats after run.
collector (TestCollector) – The collector that gathered our tests.
timeout (int) – The amount of time to wait for responses before failing tests.
-
distest.
run_dtest_bot
(sysargs, test_collector, timeout=5)[source]¶ This is the function you will call in your test suite’s
if __name__ == "__main__":
statement to get the bot started.- Parameters
sysargs (list) – The list returned by
sys.argv
, this function parses it and will handle errors in formattest_collector (TestCollector) – The Collector that has been used to decorate the tests
timeout (int) – An optional parameter to override the amount of time to wait for responses before failing tests. Defaults to 5 seconds.
-
distest.
run_interactive_bot
(target_name, token, test_collector, timeout=5)[source]¶ Run the bot in interactive mode.
Relies on
run_dtest_bot()
to parse the command line arguments and pass them here. Not really meant to be called by the user.- Parameters
target_name (str) – The display name of the bot we are testing.
token (str) – The tester’s token, used to log in.
test_collector (TestCollector) – The collector that gathered our tests.
timeout (int) – The amount of time to wait for responses before failing tests.