Mercurial > p > roundup > code
view test/test_init.py @ 7827:604da0650797
test: add basic tests using hypothesis
It is segregated to its own file.
I am skipping the entire file using importorskip().
Mixing hypothesis tests with non-hypothesis tests is tricky.
Hypothesis uses decorators before test commands:
@given(text())
@settings(max_examples=_max_examples)
Pytest runs the decorators and the arguments as part of scanning the
file for tests. This means the decorator (given, settings ...) and the
strategies inside the decorators (e.g. text()) have to be defined
using a lambda or something. Only aborting at the top of the file
using importorskip prevents having to define all the symbols that
would be imported from hypothesis.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 24 Mar 2024 13:49:52 -0400 |
| parents | 198b6e810c67 |
| children |
line wrap: on
line source
#-*- encoding: utf-8 -*- import unittest, os, pprint, difflib, textwrap from roundup.init import loadTemplateInfo class TemplateInfoTestCase(unittest.TestCase): def testLoadTemplateInfo(self): path = os.path.join(os.path.dirname(__file__), '../share/roundup/templates/classic') self.maxDiff = None self.assertEqual( loadTemplateInfo(path), { 'description': textwrap.dedent('''\ This is a generic issue tracker that may be used to track bugs, feature requests, project issues or any number of other types of issues. Most users of Roundup will find that this template suits them, with perhaps a few customisations.'''), 'intended-for': 'All first-time Roundup users', 'name': 'classic', 'path': path } ) # vim: set et sts=4 sw=4 :
