File: README.source

package info (click to toggle)
reportbug 6.6.3%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 1,380 kB
  • sloc: python: 8,496; sh: 51; makefile: 40; lisp: 31
file content (106 lines) | stat: -rw-r--r-- 3,292 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Source layout
=============

The source tree for ``reportbug`` is organised this way:

* Top level

  * Manual pages.

* Debian packaging

  * ``debian/`` contains the control files used to build the Debian
    source and binary packages.

* Programs

  * ``bin/`` contains the end-user programs (e.g. ``reportbug``,
    ``querybts``).

* Libraries

  * ``reportbug/`` contains the Python library module package used by
    the programs.

* `Unit testing framework`_

  * ``test/`` contains the unit test suite. Unit test modules are
    discovered and run using the ``nosetests`` program, and are named
    as ``test_*.py``.

* Internal checking framework

  * ``checks/`` contains various scripts that ensure reportbug's
    internals are up-to-date with the Debian BTS.

* Internationalisation and localisation

  * ``po4a/`` contains configuration and data for localisation of
    source files using the ``po4a`` tool.

Unit testing framework
======================

The reportbug source package now has a unit testing framework.

The directory ``test/`` contains unit test modules and supporting
files. New unit test modules should be added to this directory and
named ``test_*.py``.

The unit test suite depends on the `python-nose` package being
installed, to make the ``nosetests`` command available. The unit tests
themselves can be written using either the `unittest` or `doctest`
modules in the standard Python library.

The `scaffold` module (from the ``test/scaffold.py`` file) contains
some helper functionality for unit tests, including an extended
`TestCase` class.

``make`` targets for testing and quality checks
-----------------------------------------------

The following ``make`` targets are useful for testing and related
tasks.

* ``make test`` runs the unit test suite, preceded by a timestamp
  banner, and reports any test failures or "OK" if all tests pass.

* ``make test-continuous`` starts a loop which clears the screen, runs
  ``make test``, then waits for any of the tests or source code to
  change, and starts the loop again.

  This is useful to run in a separate terminal during a development
  session, so that whenever a change is made the test suite will be
  run automatically. You might want to keep the window hidden while
  actually editing files, and only look at it when you've created or
  modified a file and want to check its effect on the test run.

  This uses the ``inotifywait`` command from the `inotify-tools`
  package to wait for `create` and `modify` events.

* ``make coverage`` runs the test suite and collects test coverage
  information, then reports the current statement coverage of the test
  suite.

  This requires the `python-coverage` package to be installed. See its
  documentation for more about its operation.

* ``make pyflakes`` runs the `pyflakes` static code checker on all
  Python files found in the project tree.

  This requires the `pyflakes` package to be installed. See its
  documentation for more about its operation.

* ``make pylint`` runs the `pylint` code checker on all code modules
  and programs.

  This requires the `pylint` package to be installed. See its
  documentation for more about its operation.


..
    Local Variables:
    coding: utf-8
    mode: rst
    End:
    vim: filetype=rst :