test_ok2/testing
David Röthlisberger aaa7e837cc doctest: Add +NUMBER option to ignore irrelevant floating-point differences
When enabled, floating-point numbers only need to match as far as the
precision you have written in the expected doctest output. This avoids
false positives caused by limited floating-point precision, like this:

    Expected:
        0.233
    Got:
        0.23300000000000001

This is inspired by Sébastien Boisgérault's [numtest] but the
implementation is a bit different:

* This implementation edits the literals that are in the "got"
  string (the actual output from the expression being tested), and then
  proceeds to compare the strings literally. This is similar to pytest's
  existing ALLOW_UNICODE and ALLOW_BYTES implementation.

* This implementation only compares floats against floats, not ints
  against floats. That is, the following doctest will fail with pytest
  whereas it would pass with numtest:

      >>> math.py  # doctest: +NUMBER
      3

  This behaviour should be less surprising (less false negatives) when
  you enable NUMBER globally in pytest.ini.

Advantages of this implementation compared to numtest:

* Doesn't require `import numtest` at the top level of the file.
* Works with pytest (if you try to use pytest & numtest together, pytest
  raises "TypeError: unbound method check_output() must be called with
  NumTestOutputChecker instance as first argument (got
  LiteralsOutputChecker instance instead)").
* Works with Python 3.

[numtest]: https://github.com/boisgera/numtest
2019-07-08 17:07:58 +01:00
..
code Remove ExceptionInfo.__str__, falling back to __repr__ 2019-06-06 12:20:32 -03:00
example_scripts Revert allow_abbrev=False in helper scripts 2019-06-25 14:50:07 -07:00
examples pre-commit run fix-encoding-pragma --all-files 2019-06-03 12:08:01 -03:00
freeze pre-commit run fix-encoding-pragma --all-files 2019-06-03 12:08:01 -03:00
io small mypy fixes 2019-06-06 09:13:02 -07:00
logging Fix verbosity bug in --collect-only 2019-06-05 20:10:16 -03:00
python Features assertion pass hook (#3479) 2019-06-26 21:14:19 -03:00
acceptance_test.py Replace importlib_metadata with importlib.metadata on Python 3.8+ 2019-07-04 15:00:10 +02:00
conftest.py tests: restore tracing function 2019-06-05 11:26:48 +02:00
deprecated_test.py Integrate pytest-faulthandler into the core 2019-06-21 21:02:24 -03:00
test_argcomplete.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
test_assertion.py Replace importlib_metadata with importlib.metadata on Python 3.8+ 2019-07-04 15:00:10 +02:00
test_assertrewrite.py Remove astor and reproduce the original assertion expression 2019-06-28 13:38:52 -07:00
test_cacheprovider.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_capture.py Merge remote-tracking branch 'upstream/features' into merge-features-into-master 2019-06-25 12:07:54 -03:00
test_collection.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_compat.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
test_config.py Replace importlib_metadata with importlib.metadata on Python 3.8+ 2019-07-04 15:00:10 +02:00
test_conftest.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_doctest.py doctest: Add +NUMBER option to ignore irrelevant floating-point differences 2019-07-08 17:07:58 +01:00
test_entry_points.py Replace importlib_metadata with importlib.metadata on Python 3.8+ 2019-07-04 15:00:10 +02:00
test_faulthandler.py Change pytest-faulthandler for simplification 2019-06-22 19:22:43 -03:00
test_helpconfig.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_junitxml.py Clean up u' prefixes and py2 bytes conversions 2019-06-04 17:50:34 -07:00
test_mark.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_modimport.py pre-commit run fix-encoding-pragma --all-files 2019-06-03 12:08:01 -03:00
test_monkeypatch.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
test_nodes.py pre-commit run fix-encoding-pragma --all-files 2019-06-03 12:08:01 -03:00
test_nose.py Clean up u' prefixes and py2 bytes conversions 2019-06-04 17:50:34 -07:00
test_parseopt.py Do not allow abbreviated arguments 2019-06-25 13:51:33 +10:00
test_pastebin.py Do not allow abbreviated arguments 2019-06-25 13:51:33 +10:00
test_pathlib.py Switch from deprecated imp to importlib 2019-06-24 09:48:38 -07:00
test_pdb.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
test_pluginmanager.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_pytester.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_recwarn.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
test_reports.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
test_resultlog.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
test_runner.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_runner_xunit.py pre-commit run reorder-python-imports --all-files 2019-06-03 12:08:01 -03:00
test_session.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_skipping.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
test_stepwise.py Fix test docstring 2019-06-13 23:10:13 -03:00
test_terminal.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_tmpdir.py small mypy fixes 2019-06-06 09:13:02 -07:00
test_unittest.py initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
test_warning_types.py Make pytest warnings show as from 'pytest' module instead of '_pytest.warning_types' 2019-06-15 11:48:34 -03:00
test_warnings.py Turn PytestDeprecationWarning into error 2019-06-05 19:02:52 -03:00