Merge "Capitalize first characters in param docs"

This commit is contained in:
Jenkins 2016-05-11 19:33:32 +00:00 committed by Gerrit Code Review
commit 12e373f5e3

View File

@ -100,7 +100,7 @@ def _filter_test_runs_by_date(query, start_date=None, stop_date=None):
def get_engine(use_slave=False): def get_engine(use_slave=False):
"""Get a new sqlalchemy engine instance """Get a new sqlalchemy engine instance
:param bool use_slave if possible, use 'slave' database for this engine :param bool use_slave: If possible, use 'slave' database for this engine
:return: The engine object for the database connection :return: The engine object for the database connection
:rtype: sqlalchemy.engine.Engine :rtype: sqlalchemy.engine.Engine
@ -117,15 +117,15 @@ def create_test(test_id, run_count=0, success=0, failure=0, run_time=0.0,
track the run history of a unique test over all runs. track the run history of a unique test over all runs.
:param str test_id: test_id identifying the test :param str test_id: test_id identifying the test
:param int run_count: total number or runs defaults to 0 :param int run_count: Total number or runs defaults to 0
:param int success: number of successful runs defaults 0 :param int success: Number of successful runs defaults 0
:param int failure: number of failed runs defaults to 0 :param int failure: Number of failed runs defaults to 0
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The test object stored in the DB :return: The test object stored in the DB
:rtype: subunit2sql.models.Test :rtype: subunit2sql.models.Test
:raises InvalidRunCount: if the run_count doesn't equal the sum of the :raises InvalidRunCount: If the run_count doesn't equal the sum of the
successes and failures. successes and failures.
""" """
if run_count != success + failure: if run_count != success + failure:
@ -148,12 +148,12 @@ def update_test(values, test_id, session=None):
This method will take a dictionary of fields to update for a specific test. This method will take a dictionary of fields to update for a specific test.
If a field is omitted it will not be changed in the DB. If a field is omitted it will not be changed in the DB.
:param dict values: dict of values to update the test with. The key is the :param dict values: Dict of values to update the test with. The key is the
column name and the value is the new value to be stored column name and the value is the new value to be stored
in the DB in the DB
:param str test_id: the uuid of the test to update. (value of the id column :param str test_id: The uuid of the test to update. (value of the id column
for the row to be updated) for the row to be updated)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The updated test object stored in the DB :return: The updated test object stored in the DB
@ -170,16 +170,16 @@ def create_run(skips=0, fails=0, passes=0, run_time=0, artifacts=None,
id=None, session=None, run_at=None): id=None, session=None, run_at=None):
"""Create a new run record in the database """Create a new run record in the database
:param int skips: total number of skipped tests defaults to 0 :param int skips: Total number of skipped tests defaults to 0
:param int fails: total number of failed tests defaults to 0 :param int fails: Total number of failed tests defaults to 0
:param int passes: total number of passed tests defaults to 0 :param int passes: Total number of passed tests defaults to 0
:param float run_time: total run timed defaults to 0 :param float run_time: Total run timed defaults to 0
:param str artifacts: A link to any artifacts from the test run defaults to :param str artifacts: A link to any artifacts from the test run defaults to
None None
:param str id: the run id for the new run, needs to be a unique value :param str id: The run id for the new run, needs to be a unique value
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:param run_at: optional time at which the run was started. If not specified :param run_at: Optional time at which the run was started. If not specified
the time that data is added to the DB will be used instead the time that data is added to the DB will be used instead
:return: The run object stored in the DB :return: The run object stored in the DB
@ -207,12 +207,12 @@ def update_run(values, run_id, session=None):
This method will take a dictionary of fields to update for a specific run. This method will take a dictionary of fields to update for a specific run.
If a field is omitted it will not be changed in the DB. If a field is omitted it will not be changed in the DB.
:param dict values: dict of values to update the test with. The key is the :param dict values: Dict of values to update the test with. The key is the
column name and the value is the new value to be stored column name and the value is the new value to be stored
in the DB in the DB
:param str run_id: the uuid of the run to update. (value of the id column :param str run_id: The uuid of the run to update. (value of the id column
for the row to be updated) for the row to be updated)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The updated run object stored in the DB :return: The updated run object stored in the DB
@ -231,12 +231,12 @@ def update_test_run(values, test_run_id, session=None):
This method will take a dictionary of fields to update for a specific This method will take a dictionary of fields to update for a specific
test_run. If a field is omitted it will not be changed in the DB. test_run. If a field is omitted it will not be changed in the DB.
:param dict values: dict of values to update the test with. The key is the :param dict values: Dict of values to update the test with. The key is the
column name and the value is the new value to be stored column name and the value is the new value to be stored
in the DB in the DB
:param str test_run_id: the uuid of the test_run to update. (value of the :param str test_run_id: The uuid of the test_run to update. (value of the
id column for the row to be updated) id column for the row to be updated)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The updated test_run object stored in the DB :return: The updated test_run object stored in the DB
@ -255,11 +255,11 @@ def add_run_metadata(meta_dict, run_id, session=None):
This method will take a dictionary and store key value pair metadata in the This method will take a dictionary and store key value pair metadata in the
DB associated with the specified run. DB associated with the specified run.
:param dict meta_dict: a dictionary which will generate a separate key :param dict meta_dict: A dictionary which will generate a separate key
value pair row associated with the run_id value pair row associated with the run_id
:param str run_id: the uuid of the run to update. (value of the id column :param str run_id: The uuid of the run to update. (value of the id column
for the row to be updated) for the row to be updated)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of created metadata objects :return list: The list of created metadata objects
@ -283,7 +283,7 @@ def get_run_metadata(run_id, session=None):
"""Return all run metadata objects associated with a given run. """Return all run metadata objects associated with a given run.
:param str run_id: The uuid of the run to get all the metadata :param str run_id: The uuid of the run to get all the metadata
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of metadata objects :return list: The list of metadata objects
@ -302,7 +302,7 @@ def get_runs_by_key_value(key, value, session=None):
:param key: The key to be matched :param key: The key to be matched
:param value: The value to be matched :param value: The value to be matched
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of runs :return list: The list of runs
:rtype: subunit2sql.models.Run :rtype: subunit2sql.models.Run
@ -322,14 +322,14 @@ def create_test_run(test_id, run_id, status, start_time=None,
This method creates a new record in the database This method creates a new record in the database
:param str test_id: uuid for test that was run :param str test_id: UUID for test that was run
:param str run_id: uuid for run that this was a member of :param str run_id: UUID for run that this was a member of
:param str status: status of the test run, normally success, fail, or skip :param str status: Status of the test run, normally success, fail, or skip
:param datetime.Datetime start_time: when the test was started defaults to :param datetime.Datetime start_time: When the test was started defaults to
None None
:param datetime.Datetime end_time: when the test was finished defaults to :param datetime.Datetime end_time: When the test was finished defaults to
None None
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The test_run object stored in the DB :return: The test_run object stored in the DB
@ -366,11 +366,11 @@ def add_test_run_metadata(meta_dict, test_run_id, session=None):
This method will take a dictionary and store key value pair metadata in the This method will take a dictionary and store key value pair metadata in the
DB associated with the specified run. DB associated with the specified run.
:param dict meta_dict: a dictionary which will generate a separate key :param dict meta_dict: A dictionary which will generate a separate key
value pair row associated with the test_run_id value pair row associated with the test_run_id
:param str test_run_id: the uuid of the test_run to update. (value of the :param str test_run_id: The uuid of the test_run to update. (value of the
id column for the row to be updated) id column for the row to be updated)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of created metadata objects :return list: The list of created metadata objects
@ -393,7 +393,7 @@ def get_test_run_metadata(test_run_id, session=None):
"""Return all run metadata objects for associated with a given run. """Return all run metadata objects for associated with a given run.
:param str test_run_id: The uuid of the test_run to get all the metadata :param str test_run_id: The uuid of the test_run to get all the metadata
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of created metadata objects :return list: The list of created metadata objects
@ -411,11 +411,11 @@ def add_test_metadata(meta_dict, test_id, session=None):
This method will take a dictionary and store key value pair metadata in the This method will take a dictionary and store key value pair metadata in the
DB associated with the specified run. DB associated with the specified run.
:param dict meta_dict: a dictionary which will generate a separate key :param dict meta_dict: A dictionary which will generate a separate key
value pair row associated with the test_run_id value pair row associated with the test_run_id
:param str test_id: the uuid of the test to update. (value of the :param str test_id: The uuid of the test to update. (value of the
id column for the row to be updated) id column for the row to be updated)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of created metadata objects :return list: The list of created metadata objects
@ -438,7 +438,7 @@ def get_test_metadata(test_id, session=None):
"""Return all test metadata objects for associated with a given test. """Return all test metadata objects for associated with a given test.
:param str test_id: The uuid of the test to get all the metadata :param str test_id: The uuid of the test to get all the metadata
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of created metadata objects :return list: The list of created metadata objects
@ -453,7 +453,7 @@ def get_test_metadata(test_id, session=None):
def get_all_tests(session=None): def get_all_tests(session=None):
"""Return all tests from the DB. """Return all tests from the DB.
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of test objects :return list: The list of test objects
@ -517,9 +517,9 @@ def get_test_prefixes(session=None):
the prefix, and the result of this function will be all unique test ids in the prefix, and the result of this function will be all unique test ids in
the database. the database.
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: a list of all unique prefix strings, with any extraneous :return list: A list of all unique prefix strings, with any extraneous
details removed, e.g. 'setUpClass ('. details removed, e.g. 'setUpClass ('.
:rtype: str :rtype: str
""" """
@ -589,12 +589,12 @@ def get_tests_by_prefix(prefix, session=None, limit=100, offset=0):
prefix will be considered the full test id, and this method may return prefix will be considered the full test id, and this method may return
unexpected results. unexpected results.
:param str prefix: the test prefix to search for :param str prefix: The test prefix to search for
:param session: optional session object: if one isn't provided, a new :param session: Optional session object: if one isn't provided, a new
session will be acquired for the duration of this operation session will be acquired for the duration of this operation
:param int limit: the maximum number of results to return :param int limit: The maximum number of results to return
:param int offset: the starting index, for pagination purposes :param int offset: The starting index, for pagination purposes
:return list: the list of matching test objects, ordered by their test id :return list: The list of matching test objects, ordered by their test id
:rtype: subunit2sql.models.Test :rtype: subunit2sql.models.Test
""" """
session = session or get_session() session = session or get_session()
@ -609,11 +609,11 @@ def get_tests_by_prefix(prefix, session=None, limit=100, offset=0):
def get_all_runs_by_date(start_date=None, stop_date=None, session=None): def get_all_runs_by_date(start_date=None, stop_date=None, session=None):
"""Return all runs from the DB. """Return all runs from the DB.
:param str: optional start_date, if provided only runs started at or after :param str: Optional start_date, if provided only runs started at or after
the start_date will be included in the response the start_date will be included in the response
:param str: optional end_date, if provided only runs started at or before :param str: Optional end_date, if provided only runs started at or before
the end_date will be included in the response the end_date will be included in the response
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of run objects :return list: The list of run objects
@ -632,7 +632,7 @@ def get_all_runs_by_date(start_date=None, stop_date=None, session=None):
def get_all_runs(session=None): def get_all_runs(session=None):
"""Return all runs from the DB. """Return all runs from the DB.
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of run objects :return list: The list of run objects
@ -645,7 +645,7 @@ def get_all_runs(session=None):
def get_all_test_runs(session=None): def get_all_test_runs(session=None):
"""Return all test runs from the DB. """Return all test runs from the DB.
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of test run objects :return list: The list of test run objects
@ -659,7 +659,7 @@ def get_all_test_runs(session=None):
def get_latest_run(session=None): def get_latest_run(session=None):
"""Return the most recently created run from the DB. """Return the most recently created run from the DB.
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The latest run object :return: The latest run object
@ -677,8 +677,8 @@ def get_failing_from_run(run_id, session=None):
This method will return all the test run objects that failed during the This method will return all the test run objects that failed during the
specified run. specified run.
:param str run_id: uuid for the run to find all the failing runs :param str run_id: UUID for the run to find all the failing runs
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of failing test runs for the given run :return list: The list of failing test runs for the given run
@ -694,7 +694,7 @@ def get_test_by_id(id, session=None):
"""Get an individual test by it's uuid. """Get an individual test by it's uuid.
:param str id: The uuid for the test (the id field in the DB) :param str id: The uuid for the test (the id field in the DB)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The specified test object :return: The specified test object
@ -711,7 +711,7 @@ def get_test_by_test_id(test_id, session=None):
:param str test_id: The id (aka the test name) for the test (the test_id :param str test_id: The id (aka the test name) for the test (the test_id
field in the DB) field in the DB)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The specified test object :return: The specified test object
@ -727,7 +727,7 @@ def get_run_id_from_uuid(uuid, session=None):
"""Get the id for a run by it's uuid """Get the id for a run by it's uuid
:param str uuid: The uuid for the run :param str uuid: The uuid for the run
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The id for the run with the provided uuid :return: The id for the run with the provided uuid
:rtype: int :rtype: int
@ -742,7 +742,7 @@ def get_run_by_id(id, session=None):
"""Get an individual run by it's id. """Get an individual run by it's id.
:param str id: The id for the run :param str id: The id for the run
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The specified run object :return: The specified run object
@ -757,7 +757,7 @@ def get_test_run_by_id(test_run_id, session=None):
"""Get an individual test run by it's id. """Get an individual test run by it's id.
:param str test_run_id: The id for the test run :param str test_run_id: The id for the test run
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The specified test run object :return: The specified test run object
@ -774,7 +774,7 @@ def get_test_runs_by_test_id(test_id, session=None):
:param str test_id: The test's uuid (the id column in the test table) which :param str test_id: The test's uuid (the id column in the test table) which
to get all test runs for to get all test runs for
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of test run objects for the specified test :return list: The list of test run objects for the specified test
@ -793,16 +793,16 @@ def get_test_runs_by_test_test_id(test_id, start_date=None, stop_date=None,
:param str test_id: The test's test_id (the test_id column in the test :param str test_id: The test's test_id (the test_id column in the test
table) which to get all test runs for table) which to get all test runs for
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:param datetime.datetime start_date: The date to use as the start date for :param datetime.datetime start_date: The date to use as the start date for
results results
:param datetime.datetime stop_date: The date to use as the cutoff date for :param datetime.datetime stop_date: The date to use as the cutoff date for
results results
:param str key: an optional key for run metadata to filter the test runs :param str key: An optional key for run metadata to filter the test runs
on. Must be specified with a value otherwise it does on. Must be specified with a value otherwise it does
nothing. nothing.
:param str value: an optional value for run metadata to filter the test :param str value: An optional value for run metadata to filter the test
runs on. Must be specified with a key otherwise it does runs on. Must be specified with a key otherwise it does
nothing. nothing.
@ -836,7 +836,7 @@ def get_test_runs_by_run_id(run_id, session=None):
:param str run_id: The run's uuid (the uuid column in the run table) which :param str run_id: The run's uuid (the uuid column in the run table) which
to get all test runs for to get all test runs for
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of test run objects for the specified test :return list: The list of test run objects for the specified test
@ -855,7 +855,7 @@ def get_test_run_duration(test_run_id, session=None):
:param str test_run_id: The test_run's uuid (the id column in the test_run :param str test_run_id: The test_run's uuid (the id column in the test_run
table) to get the duration of table) to get the duration of
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The duration of the test run in secs :return: The duration of the test run in secs
@ -879,7 +879,7 @@ def get_tests_from_run_id(run_id, session=None):
:param str run_id: The run's uuid (the id column in the run table) which to :param str run_id: The run's uuid (the id column in the run table) which to
get all tests for get all tests for
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
:return list: The list of test objects for the specified test :return list: The list of test objects for the specified test
:rtype: subunit2sql.models.Test :rtype: subunit2sql.models.Test
@ -902,7 +902,7 @@ def get_tests_run_dicts_from_run_id(run_id, session=None):
:param str run_id: The run's uuid (the id column in the run table) which to :param str run_id: The run's uuid (the id column in the run table) which to
use to select it's run ids to collect information for. use to select it's run ids to collect information for.
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
:return dict: A dictionary with the test_id from the tests for keys that :return dict: A dictionary with the test_id from the tests for keys that
contains all the stored information about the test_runs. contains all the stored information about the test_runs.
@ -958,7 +958,7 @@ def get_test_run_time_series(test_id, session=None):
:param str test_id: The test's uuid (the id column in the test table) which :param str test_id: The test's uuid (the id column in the test table) which
will be used to get all the test run times for. will be used to get all the test run times for.
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
:return dict: A dictionary with the start times as the keys and the values :return dict: A dictionary with the start times as the keys and the values
being the duration of the test that started at that time in being the duration of the test that started at that time in
@ -985,13 +985,13 @@ def get_test_run_series(start_date=None, stop_date=None, session=None,
:param str start_date: Optional start date to filter results on :param str start_date: Optional start date to filter results on
:param str stop_date: Optional stop date to filter results on :param str stop_date: Optional stop date to filter results on
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
:param str key: optional run_metadata key to filter the runs used on. Key :param str key: Optional run_metadata key to filter the runs used on. Key
must be specified with value for filtering to occur. must be specified with value for filtering to occur.
This defaults to 'build_queue' for backwards compatibility This defaults to 'build_queue' for backwards compatibility
with earlier versions. Note, this default will be removed with earlier versions. Note, this default will be removed
in the future. in the future.
:param str value: optional run_metadata value to filter the runs used on. :param str value: Optional run_metadata value to filter the runs used on.
Value must be specified with key for filtering to occur. Value must be specified with key for filtering to occur.
This defaults to 'gate' for backwards This defaults to 'gate' for backwards
compatibility with earlier versions. Note, this default compatibility with earlier versions. Note, this default
@ -1030,7 +1030,7 @@ def get_test_status_time_series(test_id, session=None):
:param str test_id: The test's uuid (the id column in the test table) which :param str test_id: The test's uuid (the id column in the test table) which
will be used to get all the test run times for. will be used to get all the test run times for.
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
:return dict: A dictionary with the start times as the keys and the values :return dict: A dictionary with the start times as the keys and the values
being the status of that test run. being the status of that test run.
@ -1053,7 +1053,7 @@ def get_recent_successful_runs(num_runs=10, session=None):
"""Return a list of run uuid strings for the most recent successful runs """Return a list of run uuid strings for the most recent successful runs
:param int num_runs: The number of runs to return in the list :param int num_runs: The number of runs to return in the list
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
:return list: A list of run uuid strings (the id column in the runs table) :return list: A list of run uuid strings (the id column in the runs table)
for the most recent runs. for the most recent runs.
@ -1068,7 +1068,7 @@ def get_recent_failed_runs(num_runs=10, session=None):
"""Return a list of run uuid strings for the most recent failed runs """Return a list of run uuid strings for the most recent failed runs
:param int num_runs: The number of runs to return in the list :param int num_runs: The number of runs to return in the list
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
:return list: A list of run uuid strings (the id column in the runs table) :return list: A list of run uuid strings (the id column in the runs table)
for the most recent runs. for the most recent runs.
@ -1085,7 +1085,7 @@ def get_recent_runs_by_key_value_metadata(key, value, num_runs=10,
"""Get a list of runs for recent runs with a key value metadata pair """Get a list of runs for recent runs with a key value metadata pair
:param int num_runs: The number of runs to return in the list :param int num_runs: The number of runs to return in the list
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
:return list: A list of run objects for the most recent runs. :return list: A list of run objects for the most recent runs.
:rtype subunit2sql.db.models.Run :rtype subunit2sql.db.models.Run
""" """
@ -1104,7 +1104,7 @@ def delete_old_runs(expire_age=186, session=None):
:param int expire_age: The number of days into the past to use as the :param int expire_age: The number of days into the past to use as the
expiration date for deleting the runs expiration date for deleting the runs
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
""" """
session = session or get_session() session = session or get_session()
expire_date = datetime.date.today() - datetime.timedelta(days=expire_age) expire_date = datetime.date.today() - datetime.timedelta(days=expire_age)
@ -1125,7 +1125,7 @@ def delete_old_test_runs(expire_age=186, session=None):
:param int expire_age: The number of days into the past to use as the :param int expire_age: The number of days into the past to use as the
expiration date for deleting the test runs expiration date for deleting the test runs
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
""" """
session = session or get_session() session = session or get_session()
expire_date = datetime.date.today() - datetime.timedelta(days=expire_age) expire_date = datetime.date.today() - datetime.timedelta(days=expire_age)
@ -1146,7 +1146,7 @@ def get_id_from_test_id(test_id, session=None):
"""Return the id (uuid primary key) for a test given it's test_id value """Return the id (uuid primary key) for a test given it's test_id value
:param str test_id: The test_id's string (not UUID) to identify the test :param str test_id: The test_id's string (not UUID) to identify the test
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The id for the specified test :return: The id for the specified test
:rtype: str :rtype: str
@ -1159,7 +1159,7 @@ def get_id_from_test_id(test_id, session=None):
def get_ids_for_all_tests(session=None): def get_ids_for_all_tests(session=None):
"""Return a list of ids (uuid primary key) for all tests in the database """Return a list of ids (uuid primary key) for all tests in the database
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: The list of all ids for tests in the tests table :return: The list of all ids for tests in the tests table
:rtype: list :rtype: list
@ -1211,9 +1211,9 @@ def get_test_counts_in_date_range(test_id, start_date=None, stop_date=None,
:param str test_id: The test_id's ID(big integer) to identify the test :param str test_id: The test_id's ID(big integer) to identify the test
:param str start_date: The date to use as the start for counting :param str start_date: The date to use as the start for counting
:param str stop_date: The date to use as the cutoff for counting :param str stop_date: The date to use as the cutoff for counting
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: a dict containing the number of successes, failures, and skips :return: A dict containing the number of successes, failures, and skips
:rtype: dict :rtype: dict
""" """
start_date = datetime.datetime.strptime(start_date, '%b %d %Y') start_date = datetime.datetime.strptime(start_date, '%b %d %Y')
@ -1259,7 +1259,7 @@ def get_failing_test_ids_from_runs_by_key_value(key, value, session=None):
:param str key: The key to use to match runs from in run_metadata :param str key: The key to use to match runs from in run_metadata
:param str value: The value of the key in run_metadata to match runs :param str value: The value of the key in run_metadata to match runs
against against
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return: A list of test_ids that failed from runs that match the provided :return: A list of test_ids that failed from runs that match the provided
@ -1341,12 +1341,12 @@ def get_all_runs_time_series_by_key(key, start_date=None,
This method will get a time series dictionary of run summary views which This method will get a time series dictionary of run summary views which
are grouped by the values of the specified key are grouped by the values of the specified key
:param str key: the key to use for grouping the run summaries :param str key: The key to use for grouping the run summaries
:param str start_date: Optional start date to filter results on :param str start_date: Optional start date to filter results on
:param str stop_date: Optional stop date to filter results on :param str stop_date: Optional stop date to filter results on
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return runs: a time series dictionary of runs grouped by values of the :return runs: A time series dictionary of runs grouped by values of the
specified key specified key
:rtype: dict :rtype: dict
""" """
@ -1389,15 +1389,15 @@ def get_time_series_runs_by_key_value(key, value, start_date=None,
stop_date=None, session=None): stop_date=None, session=None):
"""Get a time series of runs with meta for all runs with a key value pai """Get a time series of runs with meta for all runs with a key value pai
:param str key: the metadata key to use for matching the runs :param str key: The metadata key to use for matching the runs
:param str value: the metadata value to use for matching the runs :param str value: The metadata value to use for matching the runs
:param start_date: Optional start date to filter results on :param start_date: Optional start date to filter results on
:param str stop_date: Optional stop date to filter results on :param str stop_date: Optional stop date to filter results on
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return runs: a time series dictionary (where the top level key is a :return runs: A time series dictionary (where the top level key is a
timestamp) that contains all the runs which timestamp) that contains all the runs which
:rtype: dict :rtype: dict
""" """
@ -1465,11 +1465,11 @@ def get_run_failure_rate_by_key_value_metadata(key, value, start_date=None,
stop_date=None, session=None): stop_date=None, session=None):
"""Return the failure percentage of runs with a set of run metadata """Return the failure percentage of runs with a set of run metadata
:param str key: the metadata key to use for matching the runs :param str key: The metadata key to use for matching the runs
:param str value: the metadata value to use for matching the runs :param str value: The metadata value to use for matching the runs
:param start_date: Optional start date to filter results on :param start_date: Optional start date to filter results on
:param str stop_date: Optional stop date to filter results on :param str stop_date: Optional stop date to filter results on
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return failure_rate: The percentage of runs that failed, will be None if :return failure_rate: The percentage of runs that failed, will be None if
@ -1497,12 +1497,12 @@ def add_test_run_attachments(attach_dict, test_run_id, session=None):
This method will take a dictionary and store key blob pair attachments in This method will take a dictionary and store key blob pair attachments in
the DB associated with the specified test_run. the DB associated with the specified test_run.
:param dict attachments_dict: a dictionary which will generate a separate :param dict attachments_dict: A dictionary which will generate a separate
key blob pair row associated with the key blob pair row associated with the
test_run_id test_run_id
:param str test_run_id: the uuid of the test_run to update. (value of the :param str test_run_id: The uuid of the test_run to update. (value of the
id column for the row to be updated) id column for the row to be updated)
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of created attachment objects :return list: The list of created attachment objects
@ -1526,12 +1526,12 @@ def get_recent_failed_runs_by_run_metadata(key, value, num_runs=10,
start_date=None, session=None): start_date=None, session=None):
"""Get a list of recent failed runs for a given run metadata pair """Get a list of recent failed runs for a given run metadata pair
:param str key: the run_metadata key to get failed runs :param str key: The run_metadata key to get failed runs
:param str value: The run_metadata value to get failed runs :param str value: The run_metadata value to get failed runs
:param int num_runs: The number of results to fetch, defaults to 10 :param int num_runs: The number of results to fetch, defaults to 10
:param datetime start_date: the optional starting dates to get runs from. :param datetime start_date: The optional starting dates to get runs from.
Nothing older than this date will be returned Nothing older than this date will be returned
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return list: The list of recent failed Run objects :return list: The list of recent failed Run objects
@ -1591,10 +1591,10 @@ def get_test_runs_by_status_for_run_ids(status, run_ids, key=None,
table) to get the test runs from table) to get the test runs from
:param str key: An optional run_metadata key to add the values for a run :param str key: An optional run_metadata key to add the values for a run
to the output dict for each test_run to the output dict for each test_run
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return test_runs: a list of dicts for the test_runs and associated data :return test_runs: A list of dicts for the test_runs and associated data
:rtype: list :rtype: list
""" """
session = session or get_session() session = session or get_session()
@ -1644,10 +1644,10 @@ def get_test_runs_by_status_for_run_ids(status, run_ids, key=None,
def get_all_run_metadata_keys(session=None): def get_all_run_metadata_keys(session=None):
"""Get a list of all the keys used in the run_metadata table """Get a list of all the keys used in the run_metadata table
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return keys: a list of all keys used in the run_metadata table :return keys: A list of all keys used in the run_metadata table
:rtype: list :rtype: list
""" """
session = session or get_session() session = session or get_session()
@ -1658,10 +1658,10 @@ def get_all_run_metadata_keys(session=None):
def get_all_test_metadata_keys(session=None): def get_all_test_metadata_keys(session=None):
"""Get a list of all the keys used in the test_metadata table """Get a list of all the keys used in the test_metadata table
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return keys: a list of all keys used in the test_metadata table :return keys: A list of all keys used in the test_metadata table
:rtype: list :rtype: list
""" """
session = session or get_session() session = session or get_session()
@ -1672,10 +1672,10 @@ def get_all_test_metadata_keys(session=None):
def get_all_test_run_metadata_keys(session=None): def get_all_test_run_metadata_keys(session=None):
"""Get a list of all the keys used in the test_run_metadata table """Get a list of all the keys used in the test_run_metadata table
:param session: optional session object if one isn't provided a new session :param session: Optional session object if one isn't provided a new session
will be acquired for the duration of this operation will be acquired for the duration of this operation
:return keys: a list of all keys used in the test_run_metadata table :return keys: A list of all keys used in the test_run_metadata table
:rtype: list :rtype: list
""" """
session = session or get_session() session = session or get_session()