Test definition

Module tests

Tests of pyyc.mod functions, to be run with pytest:

$ pytest -v test_mod.py

Ideally, each function and use case should be tested: standard use (as described in documentation), invalid use (handled with documented exceptions), corner cases, etc.

Note

Some parts of the code are voluntarily left untested to be used as example in coverage report.

tests.test_mod.test_version()[source]

Simple test.

tests.test_mod.test_addition_int_list()[source]

Single test of pyyc.mod.addition() on list of int.

tests.test_mod.test_addition_str_list()[source]

Single test of pyyc.mod.addition() on list of str.

tests.test_mod.test_addition_parametrized(test_input, expected_output)[source]

Test standard usage of pyyc.mod.addition().

This test uses parametrization of arguments, see How to parametrize fixtures and test functions.

Tip

addition(*args) will unpack the arguments on-the-fly and is similar to addition(args[0], args[1], ...).

tests.test_mod.test_addition_TypeError(test_input)[source]

Test incompatible argument case.

It should raise TypeError, as mentioned in documentation of pyyc.mod.addition().

tests.test_mod.test_addition_empty()[source]

Test no argument case.

It should raise IndexError, not documented.

tests.test_mod.test_read_config_version()[source]

Test a single value in configuration file.

tests.test_mod.test_read_config_content(capsys)[source]

Test full content of configuration file.

This test uses stdout capture, see How to capture stdout/stderr output.

tests.test_mod.test_read_config_filename()[source]

Test explicit configuration filename.

tests.test_mod.test_read_config_IOError()[source]

Test non-existing or invalid configuration files.

tests.test_mod.test_format_pkg_tree()[source]

Test standard usage of pyyc.mod.format_pkg_tree().

tests.test_mod.test_greetings(capsys, monkeypatch)[source]

This test uses both input monkey patching (to simulate input from user) and stdout capture.