Policies

class testoot.base.CanonizePolicy[source]

Abstract run decisions with conflicted tests

abstract ask_canonize(test_result: testoot.base.TestootTestResult) → bool[source]

Asks user for canonization or decide it by internal tests policies

class testoot.policies.AskCanonizePolicy(user_interaction: testoot.base.UserInteraction)[source]

If context allows to show canonization dialog then use provided user interaction.

__init__(user_interaction: testoot.base.UserInteraction)[source]

Initialize self. See help(type(self)) for accurate signature.

ask_canonize(test_result: testoot.base.TestootTestResult) → bool[source]

Asks user for canonization or decide it by internal tests policies

class testoot.policies.NoCanonizePolicy[source]

Raises exception on any data mismatch in testing.

ask_canonize(test_result: testoot.base.TestootTestResult) → bool[source]

Asks user for canonization or decide it by internal tests policies

class testoot.base.UserInteraction[source]

Abstract interaction with user

abstract ask_canonize(test_result: testoot.base.TestootTestResult) → bool[source]

Asks user for canonization

class testoot.user_interactions.ConstantUserInteraction(*, canonize)[source]

Have constant response to all canonize requests.

__init__(*, canonize)[source]

Initialize self. See help(type(self)) for accurate signature.

ask_canonize(test_result: testoot.base.TestootTestResult) → bool[source]

Returns stored canonize value.

class testoot.user_interactions.ConsoleUserInteraction[source]

Interactive console canonization asker.

ask_canonize(test_result: testoot.base.TestootTestResult) → bool[source]

Prints diff and asks user to canonize diff. If get y returns True.

static parse_input(value: str) → bool[source]
static show_diff(diff: str)[source]

Enabled console interaction with –canonize flag prints such text in console:

tests/test_console/test_console.py [tests/test_console/test_console.py::test_simple]
{'a': 2} == {'a': 1}
~Differing items:
~{'a': 2} != {'a': 1}
~Use -v to get the full diff
Canonize [yn]? y
.