krrood.development_tools.agents.shipped_rules.testing#

The rules on writing and running tests.

Classes#

TestingRules

The rules on tests.

WritingTestsRules

The rules on writing tests.

AssertionsRules

The rules on what a test asserts.

ExternalServicesAndCIRules

The rules on tests that reach external services, and on tests in CI.

RunningTestsRules

The rules on running tests.

Module Contents#

class krrood.development_tools.agents.shipped_rules.testing.TestingRules(*args, **kwds)#

Bases: krrood.development_tools.agents.rule.Section

The rules on tests.

class krrood.development_tools.agents.shipped_rules.testing.WritingTestsRules(*args, **kwds)#

Bases: krrood.development_tools.agents.rule.Section

The rules on writing tests.

parent() → type[krrood.development_tools.agents.rule.Section]#

The section this one is nested under; none for a top-level section.

WRITE_TESTS_WITH_PYTEST#
REUSE_FIXTURES = 'Reuse the existing fixtures in `conftest.py`'#
WORK_TEST_DRIVEN = 'Work test-driven: prove a bug with a meaningful, failing test before fixing it. Every new...#
NEVER_MODIFY_A_FAILING_TEST = 'When fixing a failing test, never modify the test itself'#
NAME_TEST_CLASSES_AFTER_BEHAVIOUR = 'Name test classes, and the mimic classes tests use, after the pattern or behaviour they...#
KEEP_SNIPPETS_IN_FILES = 'Keep code snippets in separate files of the correct type and import or read them into the test;...#
class krrood.development_tools.agents.shipped_rules.testing.AssertionsRules(*args, **kwds)#

Bases: krrood.development_tools.agents.rule.Section

The rules on what a test asserts.

parent() → type[krrood.development_tools.agents.rule.Section]#

The section this one is nested under; none for a top-level section.

ASSERT_EXACT_EXPECTED_VALUES = 'Assert equality to the expected value whenever it can be determined, never only a weaker check...#
ASSERT_AGAINST_THE_DEFINITION#
TEST_ONE_BEHAVIOUR = 'Each test checks the one behaviour it names and fails only for its own reason: assert exactly...#
class krrood.development_tools.agents.shipped_rules.testing.ExternalServicesAndCIRules(*args, **kwds)#

Bases: krrood.development_tools.agents.rule.Section

The rules on tests that reach external services, and on tests in CI.

parent() → type[krrood.development_tools.agents.rule.Section]#

The section this one is nested under; none for a top-level section.

EVERY_TEST_RUNS_IN_CI = 'Every added test is part of the CI suite. A test that needs live external calls or credentials...#
APPROVE_CI_CREDENTIALS = 'A test that needs credentials in CI must be approved by the user and have those credentials...#
MOCK_EXTERNAL_APIS = 'Mock external APIs; call one live only to download a dataset other tests need'#
PAIR_LIVE_TESTS_WITH_MOCKED_ONES = 'A test that calls an external API live must have a skip condition so it does not run in CI, and...#
class krrood.development_tools.agents.shipped_rules.testing.RunningTestsRules(*args, **kwds)#

Bases: krrood.development_tools.agents.rule.Section

The rules on running tests.

parent() → type[krrood.development_tools.agents.rule.Section]#

The section this one is nested under; none for a top-level section.

RUN_TESTS_WITH_PYTEST = 'Run tests with pytest'#
USE_THE_PROJECT_INTERPRETER = "Always use the project's configured Python interpreter for tests and commands"#
RUN_THE_SUITE_IN_PARTS = 'Never run the whole test suite in one invocation: run one package or a few test directories at...#
CAP_TEST_MEMORY = "Make sure a test run can never exhaust the machine's working memory: check the free memory...#