Python doctest.REPORT_ONLY_FIRST_FAILURE Examples
The following are 11
code examples of doctest.REPORT_ONLY_FIRST_FAILURE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
doctest
, or try the search function
.
Example #1
Source File: doctest.py From python-netsurv with MIT License | 5 votes |
def _get_report_choice(key): """ This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests. """ import doctest return { DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF, DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF, DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF, DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE, DOCTEST_REPORT_CHOICE_NONE: 0, }[key]
Example #2
Source File: doctest.py From python-netsurv with MIT License | 5 votes |
def _get_report_choice(key): """ This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests. """ import doctest return { DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF, DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF, DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF, DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE, DOCTEST_REPORT_CHOICE_NONE: 0, }[key]
Example #3
Source File: __init__.py From hts-python with MIT License | 5 votes |
def doctests(): import doctest import hts.htsffi for name, mod in (("htsffi", hts.htsffi), ("fai", hts.fai), ("fisher", hts.fisher), ("vcf", hts.vcf), ("bam", hts.bam)): mod = getattr(hts, name) print("%s: %r" % (name, doctest.testmod(m=mod, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)))
Example #4
Source File: doctest.py From pytest with MIT License | 5 votes |
def _get_report_choice(key: str) -> int: """ This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests. """ import doctest return { DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF, DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF, DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF, DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE, DOCTEST_REPORT_CHOICE_NONE: 0, }[key]
Example #5
Source File: sentence_runner.py From notebooks with MIT License | 5 votes |
def test(cls, verbose=False): res = doctest.testfile( TEST_FILE, globs={'Sentence': cls}, verbose=verbose, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE) tag = 'FAIL' if res.failed else 'OK' print(TEST_MSG.format(cls.__module__, res, tag))
Example #6
Source File: aritprog_runner.py From notebooks with MIT License | 5 votes |
def test(gen_factory, verbose=False): res = doctest.testfile( TEST_FILE, globs={'aritprog_gen': gen_factory}, verbose=verbose, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE) tag = 'FAIL' if res.failed else 'OK' print(TEST_MSG.format(gen_factory.__module__, res, tag))
Example #7
Source File: tombola_runner.py From notebooks with MIT License | 5 votes |
def test(cls, verbose=False): res = doctest.testfile( TEST_FILE, globs={'ConcreteTombola': cls}, # <5> verbose=verbose, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE) tag = 'FAIL' if res.failed else 'OK' print(TEST_MSG.format(cls.__name__, res, tag)) # <6>
Example #8
Source File: _test.py From guildai with Apache License 2.0 | 5 votes |
def _report_first_flag(): if os.getenv("REPORT_ONLY_FIRST_FAILURE") == "1": return doctest.REPORT_ONLY_FIRST_FAILURE return 0
Example #9
Source File: sentence_runner.py From example-code with MIT License | 5 votes |
def test(cls, verbose=False): res = doctest.testfile( TEST_FILE, globs={'Sentence': cls}, verbose=verbose, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE) tag = 'FAIL' if res.failed else 'OK' print(TEST_MSG.format(cls.__module__, res, tag))
Example #10
Source File: aritprog_runner.py From example-code with MIT License | 5 votes |
def test(gen_factory, verbose=False): res = doctest.testfile( TEST_FILE, globs={'aritprog_gen': gen_factory}, verbose=verbose, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE) tag = 'FAIL' if res.failed else 'OK' print(TEST_MSG.format(gen_factory.__module__, res, tag))
Example #11
Source File: tombola_runner.py From example-code with MIT License | 5 votes |
def test(cls, verbose=False): res = doctest.testfile( TEST_FILE, globs={'ConcreteTombola': cls}, # <5> verbose=verbose, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE) tag = 'FAIL' if res.failed else 'OK' print(TEST_MSG.format(cls.__name__, res, tag)) # <6>