3. Test Code Documentation

3.1. repobuddy.tests – Root package for tests

3.2. repobuddy.tests.arg_parser – Argument Parser tests

class repobuddy.tests.arg_parser.ArgParserTestCase(methodName='runTest')[source]

Bases: repobuddy.tests.common.TestCaseBase

classmethod setUpClass()[source]
classmethod tearDownClass()[source]
__init__(methodName='runTest')[source]
setUp()[source]
test_help()[source]
test_version()[source]
test_init_help()[source]
test_status_help()[source]
test_help_unsupported_command()[source]
test_unsupported_command()[source]
test_handlers()[source]
class repobuddy.tests.arg_parser.ArgParserTestSuite[source]
classmethod get_test_suite()[source]

3.3. repobuddy.tests.client_info – Client Info tests

class repobuddy.tests.client_info.ClientInfoTestCase(methodName='runTest')[source]

Bases: repobuddy.tests.common.TestCaseBase

classmethod setUpClass()[source]
classmethod tearDownClass()[source]
__init__(methodName='runTest')[source]
test_read_nonexistent_file()[source]
test_read_without_permissions()[source]
test_read_malformed_file()[source]
test_read_empty_file()[source]
test_read_without_section_header()[source]
test_read_just_section()[source]
test_read_just_options()[source]
test_read_no_client_spec()[source]
test_read_no_manifest()[source]
test_read_valid()[source]
test_read_valid_writeback()[source]
test_create_new_config()[source]
class repobuddy.tests.client_info.ClientInfoTestSuite[source]
classmethod get_test_suite()[source]

3.4. repobuddy.tests.command_handler – Command Handler tests

class repobuddy.tests.command_handler.CommandHandlerTestCase(methodName='runTest')[source]

Bases: repobuddy.tests.common.TestCaseBase

classmethod setUpClass()[source]
classmethod tearDownClass()[source]
__init__(methodName='runTest')[source]
setUp()[source]
test_verify_handlers()[source]
test_init_client_valid()[source]
class repobuddy.tests.command_handler.CommandHandlerTestSuite[source]
classmethod get_test_suite()[source]

3.5. repobuddy.tests.common – Test Framework

exception repobuddy.tests.common.ShellError(error_str)[source]

Bases: repobuddy.utils.RepoBuddyBaseException

Exception raised by ShellHelper.

__init__(error_str)[source]

Initializer.

Parameters:error_str (str) – The error string to store in the exception.
class repobuddy.tests.common.ShellHelper[source]

Helper for performing shell operations.

classmethod exec_command(command, base_dir, debug_output=True)[source]

Execute a command.

Parameters:
  • command (str) – The command to execute.
  • base_dir (str) – The base directory path.
  • debug_output – If set to False, the output of the command is NOT printed on stdout and stderr.
Returns:

None

Raises:

ShellError if the program’s execution returned a non-zero return or any other errors.

classmethod read_file_as_string(filename)[source]

Read the contents of the file as a string and return it.

Parameters:filename (str) – The name of the file to read.
Returns:Contents of the file.
Return type:str
Raises:ShellError on errors.
classmethod append_text_to_file(text, filename, base_dir)[source]
classmethod remove_file(filename)[source]
classmethod make_dir(dirname, create_parent_dirs=False, only_if_not_exists=False)[source]
classmethod remove_dir(dirname)[source]
class repobuddy.tests.common.TestCommon[source]
classmethod get_string_stream()[source]
classmethod setup_test_repos(base_dir)[source]
class repobuddy.tests.common.TestCaseBase(methodName='runTest')[source]

Bases: unittest.case.TestCase

__init__(methodName='runTest')[source]
setUp()[source]
tearDown()[source]
class repobuddy.tests.common.TestResult[source]

Bases: unittest.result.TestResult

PASSED = 0
ERROR = 1
FAILED = 2
SKIPPED = 3
EXPECTED_FAILURE = 4
UNEXPECTED_SUCCESS = 5
__init__()[source]
classmethod get_result_str(result)[source]
addError(test, err)[source]
addFailure(test, err)[source]
addSuccess(test)[source]
addSkip(test, reason)[source]
addExpectedFailure(test, err)[source]
addUnexpectedSuccess(test)[source]
class repobuddy.tests.common.TestRunner(stream, descriptions=True, verbosity=1)[source]

Bases: unittest.runner.TextTestRunner

__init__(stream, descriptions=True, verbosity=1)[source]
get_test_result()[source]
class repobuddy.tests.common.TestSuiteManager(base_dir)[source]

Bases: object

classmethod get_base_dir()[source]
__init__(base_dir)[source]
add_test_suite(test_suite)[source]
run()[source]
show_results()[source]
was_successful()[source]

3.6. repobuddy.tests.git_wrapper – Git Wrapper tests

class repobuddy.tests.git_wrapper.GitWrapperTestCase(methodName='runTest')[source]

Bases: repobuddy.tests.common.TestCaseBase

classmethod setUpClass()[source]
classmethod tearDownClass()[source]
__init__(methodName='runTest')[source]
test_clone_valid_repo()[source]
test_clone_invalid_url()[source]
test_clone_invalid_branch()[source]
test_clone_no_write_permissions()[source]
test_update_index_valid_repo()[source]
test_update_index_invalid_repo()[source]
test_untracked_no_files()[source]
test_untracked_with_files()[source]
test_unstaged_no_files()[source]
test_unstaged_with_files()[source]
test_uncommitted_no_changes()[source]
test_uncommitted_with_changes()[source]
test_current_branch_valid_repo()[source]
test_current_branch_invalid_repo()[source]
test_current_branch_detached_head()[source]
test_current_tag_lightweight_tag()[source]
test_current_tag_annotated_tag()[source]
test_current_tag_no_tag()[source]
class repobuddy.tests.git_wrapper.GitWrapperTestSuite[source]
classmethod get_test_suite()[source]

3.7. repobuddy.tests.main – Main routine for the tests

repobuddy.tests.main.run_tests()[source]

3.8. repobuddy.tests.manifest_parser – Manifest Parser tests

class repobuddy.tests.manifest_parser.ManifestParserTestCase(methodName='runTest')[source]

Bases: repobuddy.tests.common.TestCaseBase

__init__(methodName='runTest')[source]
test_repo_str_repr()[source]
test_client_spec_str_repr()[source]
test_manifest_str_repr()[source]
test_parse_invalid_file_handle()[source]
test_valid_manifest()[source]
test_malformed()[source]
test_no_client_spec()[source]
test_empty_client_spec()[source]
test_client_spec_no_name()[source]
test_empty_repo()[source]
test_repo_no_url()[source]
test_repo_empty_url()[source]
test_repo_no_branch()[source]
test_repo_empty_branch()[source]
test_repo_no_dest()[source]
test_repo_empty_dest()[source]
test_no_default_client_spec()[source]
test_empty_default_client_spec()[source]
test_nonexistent_default_client_spec()[source]
test_duplicate_client_spec()[source]
class repobuddy.tests.manifest_parser.ManifestParserTestSuite[source]
classmethod get_test_suite()[source]

3.9. repobuddy.tests.utils – Utilities tests

class repobuddy.tests.utils.UtilsTestCase(methodName='runTest')[source]

Bases: repobuddy.tests.common.TestCaseBase

classmethod setUpClass()[source]
classmethod tearDownClass()[source]
__init__(methodName='runTest')[source]
test_file_lock_basic()[source]
test_file_lock_multiple_times()[source]
test_file_lock_multiple_threads()[source]
test_file_lock_delete_with_acquire()[source]
test_file_lock_dir_without_permissions()[source]
class repobuddy.tests.utils.UtilsTestSuite[source]
classmethod get_test_suite()[source]