Merge lp://qastaging/~chad.smith/curtin/common-ci-test-case into lp://qastaging/~curtin-dev/curtin/trunk

Proposed by Chad Smith
Status: Merged
Merged at revision: 519
Proposed branch: lp://qastaging/~chad.smith/curtin/common-ci-test-case
Merge into: lp://qastaging/~curtin-dev/curtin/trunk
Diff against target: 1483 lines (+247/-347)
24 files modified
tests/unittests/helpers.py (+36/-0)
tests/unittests/test_apt_custom_sources_list.py (+3/-6)
tests/unittests/test_apt_source.py (+4/-7)
tests/unittests/test_basic.py (+4/-4)
tests/unittests/test_block.py (+20/-36)
tests/unittests/test_block_iscsi.py (+6/-18)
tests/unittests/test_block_lvm.py (+2/-2)
tests/unittests/test_block_mdadm.py (+10/-22)
tests/unittests/test_block_mkfs.py (+2/-2)
tests/unittests/test_clear_holders.py (+5/-5)
tests/unittests/test_commands_apply_net.py (+8/-20)
tests/unittests/test_commands_block_meta.py (+6/-19)
tests/unittests/test_commands_install.py (+4/-4)
tests/unittests/test_config.py (+6/-6)
tests/unittests/test_curthooks.py (+21/-46)
tests/unittests/test_feature.py (+2/-2)
tests/unittests/test_gpg.py (+4/-4)
tests/unittests/test_make_dname.py (+4/-4)
tests/unittests/test_net.py (+8/-14)
tests/unittests/test_partitioning.py (+4/-3)
tests/unittests/test_public.py (+4/-4)
tests/unittests/test_reporter.py (+29/-38)
tests/unittests/test_util.py (+48/-62)
tests/unittests/test_version.py (+7/-19)
To merge this branch: bzr merge lp://qastaging/~chad.smith/curtin/common-ci-test-case
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
curtin developers Pending
Review via email: mp+328477@code.qastaging.launchpad.net

Commit message

tests: Add CiTestCase common parent for all curtin tests

This branch makes sure all unittests subclass from CiTestCase which provides all unit tests with an add_patch method for mocking as well as tmp_dir and tmp_path creation.

Drop any unittest-specific tempfile setup in favor of self.tmp_dir and self.tmp_path.

Also drop any duplicate add_patch method definitions and convert any mock start/stop logic to add_patch where possible.

Description of the change

tests: Add CiTestCase common parent for all curtin tests

This branch makes sure all unittests subclass from CiTestCase which provides all unit tests with an add_patch method for mocking as well as tmp_dir and tmp_path creation.

Drop any unittest-specific tempfile setup in favor of self.tmp_dir and self.tmp_path.

Also drop any duplicate add_patch method definitions and convert any mock start/stop logic to add_patch where possible.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks for starting this.

I'd suggest also adding in the add_patch() which is repeated in many of the base classes in the unittests. It's fine if we punt that to a second MP after this lands as well.

Overall looks fine, couple of questions in line.

Revision history for this message
Scott Moser (smoser) wrote :

responded to ryan's comment in line. lets drop the functools.

518. By Chad Smith

drop functools partial as it is unneeded

Revision history for this message
Chad Smith (chad.smith) :
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
519. By Chad Smith

move add_patch up into CiTestCase, drop all add_patch definitions in subclasses. Convert any locally defined mock start/stop definitions to use add_patch

520. By Chad Smith

add missing super...setUp calls to classes which have overridden the unittest.setUp method

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

Looks good once you make tox happy

521. By Chad Smith

allow kwargs passed into CiTestCase.add_patch per review comments

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches