fundamentals.utKit

A unit-testing kit to simplify my unit-tests

Author

David Young

Module Contents

Classes

utKit

Default setup for fundamentals style unit-testing workflow (all tests base on nose module)

API

class fundamentals.utKit.utKit(moduleDirectory)[source][source]

Bases: object

Default setup for fundamentals style unit-testing workflow (all tests base on nose module)

Key Arguments

  • moduleDirectory – the directory to the unit-testing test file

Usage

To use this kit within any of your unit-test modules add the following code before your test methods:

from fundamentals.utKit import utKit
# SETUP AND TEARDOWN FIXTURE FUNCTIONS FOR THE ENTIRE MODULE
moduleDirectory = os.path.dirname(__file__)
utKit = utKit(moduleDirectory)
log, dbConn, pathToInputDir, pathToOutputDir = utKit.setupModule()
utKit.tearDownModule()

Initialization

get_project_root()[source][source]

Get the root of the python package - useful for getting files in the root directory of a project

Return

  • rootPath – the root path of a project

refresh_database()[source][source]

Refresh the unit test database

setupModule()[source][source]

The setupModule method

Return

  • log – a logger

  • dbConn – a database connection to a test database (details from yaml settings file)

  • pathToInputDir – path to modules own test input directory

  • pathToOutputDir – path to modules own test output directory

tearDownModule()[source][source]

The tearDownModule method