Changes between Version 11 and Version 12 of HowToWriteTests


Ignore:
Timestamp:
2020-07-14T15:39:01Z (3 months ago)
Author:
exarkun
Comment:

trivially modernize these instructions

Legend:

Unmodified
Added
Removed
Modified
  • HowToWriteTests

    v11 v12  
    88
    99{{{
    10 python setup.py trial -s allmydata.test.test_fname
     10python -m twisted.trial trial allmydata.test.test_fname
    1111}}}
    1212
    13 Okay, so it didn't work, because there is no file by that name. Create such a file, with these contents:
     13Okay, so that was boring because there are no tests in the file.  Add these contents:
    1414
    1515{{{
    16 from twisted.trial import unittest
     16from testtools.matchers import (
     17    Never,
     18)
     19from .common import (
     20    TestCase,
     21)
    1722
    18 class T(unittest.TestCase):
     23class T(TestCase):
    1924    def test_a(self):
    20         pass
     25        self.assertThat("a", Never())
    2126}}}
    2227
     
    2833
    2934{{{
    30 python setup.py trial --coverage -s allmydata.test.test_fname
     35python -m coverage run -m twisted.trial allmydata.test.test_fname
    3136}}}
    3237
    33 This does the same as running the tests without coverage -- print a list of what happened when each test was run. It also writes out a file named {{{.coverage}}} into the current directory. Run the following command to read that file and produce nice HTML pages:
     38This does the same as running the tests without coverage -- print a list of what happened when each test was run. It also writes out a file named {{{.coverage.<something>}}} into the current directory. Run the following command to read that file and produce nice HTML pages:
    3439
    3540{{{
    36 coverage html
    37 }}}
    38 
    39 If you installed coverage from Debian or Ubuntu then you have to name it {{{python-coverage}}}, like this:
    40 {{{
    41 python-coverage html
     41python -m coverage combine
     42python -m coverage html
    4243}}}
    4344