Commit Graph

10860 Commits

Author SHA1 Message Date
Ronny Pfannschmidt 4480d3e518 generate_tests: always use call_extra
- its a noop addition in the methods is empty list
2019-07-12 17:44:17 +02:00
Bruno Oliveira 4868d0d97a
Drop unittest2 support (#5565)
Drop unittest2 support
2019-07-12 11:13:51 -03:00
Bruno Oliveira 8052c7c5c6
Fix typos in a docstring (#5598)
Fix typos in a docstring
2019-07-12 07:37:50 -03:00
Ronny Pfannschmidt 13d750db20 simplify the expression which transfers mark names to keywords 2019-07-12 06:16:06 +02:00
Ronny Pfannschmidt e98627223f remove the noop init of PyobjMixin 2019-07-12 06:14:36 +02:00
Albert Tugushev c89e379f49 Fix typos 2019-07-12 02:35:44 +03:00
Bruno Oliveira 24a66db8d3 Remove support code for unittest 2
Also moved a pytest_runtest_makereport hook implemented in
nose.py, but nowadays makes more sense to be implemented in
unittest.py
2019-07-11 20:11:06 -03:00
Bruno Oliveira 4027254a4b
Fix rmtree to remove directories with read-only files (#5588)
Fix rmtree to remove directories with read-only files
2019-07-11 18:57:03 -03:00
Bruno Oliveira 37c37963c4 Fix rmtree to remove directories with read-only files
Fix #5524
2019-07-11 18:24:53 -03:00
Bruno Oliveira 666acc9b7a
doctest: Add +NUMBER option to ignore irrelevant floating-point… (#5576)
doctest: Add +NUMBER option to ignore irrelevant floating-point differences
2019-07-11 07:25:37 -03:00
David Röthlisberger a740ef2036 docs: Document doctest +NUMBER limitation with strings
Also added an "xfail" testcase for the same.
2019-07-11 10:06:57 +01:00
David Röthlisberger 4c590e002f Fix test_doctest.test_number_non_matches
These doctests were expected to fail, but they were failing because of a
silly bug (I forgot to replace "{expression}" with the actual expression
to be tested), not because of the thing they were meant to be testing.

Then I had to fix one of the testcases because it was actually matching:

    >>> 3.0 #doctest: +NUMBER
    2.99

The doctest is saying that the actual output should match to 2 decimal
places, i.e. within 0.01 -- which it is, so it passes. I changed the
expected output to 2.98 and now it doesn't match (as we expect).
2019-07-11 09:57:44 +01:00
Anthony Sottile 26b06bdb45
Merge pull request #5595 from blueyed/typos
doc: fix typos in OPENCOLLECTIVE.rst  [ci skip]
2019-07-10 14:01:16 -07:00
Daniel Hahler d5f1d7aebe doc: fix typos in OPENCOLLECTIVE.rst [ci skip] 2019-07-10 20:15:22 +02:00
Ran Benita f7747f5dd6 Remove references to old-style classes in a couple error messages
These don't exist in Python 3.
2019-07-10 20:25:45 +03:00
Thomas Grainger c224c4f1d6
de-emphasize request.addfinalizer 2019-07-10 14:52:40 +01:00
Bruno Oliveira 2c402f4bd9
[cherry-pick to master] Add rudimentary mypy type checking (#5583)
[cherry-pick to master] Add rudimentary mypy type checking
2019-07-10 07:52:32 -03:00
Bruno Oliveira 602cd5e21f
Introduce Config.invocation_params (#5564)
Introduce Config.invocation_params
2019-07-10 07:46:34 -03:00
Bruno Oliveira 57e5bd0664
Improve type-checking in OutcomeException (#5580)
Improve type-checking in OutcomeException
2019-07-09 19:12:05 -03:00
Bruno Oliveira 31738155b5
Remove deprecated features (#5529)
Remove deprecated features
2019-07-09 19:04:06 -03:00
Bruno Oliveira 9db1823707 Improve type-checking in OutcomeException
Fix #5578
2019-07-09 18:26:57 -03:00
Ran Benita 89dfde9535 Add rudimentary mypy type checking
Add a very lax mypy configuration, add it to tox -e linting, and
fix/ignore the few errors that come up. The idea is to get it running
before diving in too much.

This enables:

- Progressively adding type annotations and enabling more strict
  options, which will improve the codebase (IMO).

- Annotating the public API in-line, and eventually exposing it to
  library users who use type checkers (with a py.typed file).

Though, none of this is done yet.

Refs https://github.com/pytest-dev/pytest/issues/3342.
2019-07-09 12:12:07 -07:00
Anthony Sottile 39a43dbae1
Merge pull request #5575 from bluetech/mypy-initial
Add rudimentary mypy type checking
2019-07-09 08:05:14 -07:00
Ran Benita c1167ac552 Add rudimentary mypy type checking
Add a very lax mypy configuration, add it to tox -e linting, and
fix/ignore the few errors that come up. The idea is to get it running
before diving in too much.

This enables:

- Progressively adding type annotations and enabling more strict
  options, which will improve the codebase (IMO).

- Annotating the public API in-line, and eventually exposing it to
  library users who use type checkers (with a py.typed file).

Though, none of this is done yet.

Refs https://github.com/pytest-dev/pytest/issues/3342.
2019-07-09 10:49:17 +03:00
Bruno Oliveira 628ff4d619
Improve docs sidebar layout (#5568)
Improve docs sidebar layout
2019-07-08 19:24:48 -03:00
Bruno Oliveira add912ff68
Update doc footer/copyright (#5569)
Update doc footer/copyright
2019-07-08 19:21:38 -03:00
Bruno Oliveira b77c876481
Merge pull request #5563 from nicoddemus/sort-fix
Sort parametrize params to test_external_plugins_integrated
2019-07-08 19:10:45 -03:00
Bruno Oliveira 9b78a216a2 Remove unused import 2019-07-08 19:08:09 -03:00
Bruno Oliveira 7aff51ee83 Show warning about importing abcs from collections once
This is being raised by `unittest2.compatibility`:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
2019-07-08 17:30:15 -03:00
Bruno Oliveira e33736c791
Merge master into features (#5559)
Merge master into features
2019-07-08 17:26:49 -03:00
David Röthlisberger d5cc0f2a62 changelog for new NUMBERS doctest option 2019-07-08 17:16:35 +01:00
David Röthlisberger 2a23fdab9f docs: Tidy up doctest options section
* Move the parts about "how to configure it" (pytest.ini vs. inline
  comment) together.
* Move `--doctest-continue-on-failure` into its own sub-heading, as it
  isn't related to the doctest optionflags.
2019-07-08 17:07:58 +01:00
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
Tim Hoffmann 71c8ca7d3d Improve sidebar layout 2019-07-07 20:32:09 +02:00
Tim Hoffmann 56a0dd7658 Update doc footer/copyright 2019-07-07 20:23:56 +02:00
Bruno Oliveira 7a82285b03 Update CHANGELOG 2019-07-06 17:29:35 -03:00
Bruno Oliveira 4cda7093f6 Add note about PYTEST_ADDOPTS 2019-07-06 17:27:54 -03:00
Bruno Oliveira 6a9bf2852a Apply review suggestions: use a simple struct for invocation params 2019-07-06 12:22:19 -03:00
Bruno Oliveira 3e669a262a Introduce Config.invocation_args and Config.invocation_plugins
These attributes can be used to access the unchanged arguments passed
to pytest.main().

The intention is to use these attributes to initialize workers in
the same manner as the master node is initialized in pytest-xdist.
2019-07-05 19:45:23 -03:00
Bruno Oliveira f1b8431d99 Sort parametrize params to test_external_plugins_integrated
This might cause problems during collection with pytest-xdist; we
didn't see any so far mostly by luck I think.

Shame on me for letting that slip in.
2019-07-05 19:05:55 -03:00
Bruno Oliveira a43ba78d3b Include <testsuites> root tag in generated XML
Fix #5477
2019-07-05 11:29:35 -03:00
Bruno Oliveira 2180d9ef6d
Fix comment in stepwise (follow up to #5555) [skip ci] (#5560)
Fix comment in stepwise (follow up to #5555) [skip ci]
2019-07-05 10:26:37 -03:00
Bruno Oliveira 0371a3023a Fix comment in stepwise (follow up to #5555) [skip ci] 2019-07-05 09:57:10 -03:00
Bruno Oliveira d7588b8d40 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2019-07-05 08:14:18 -03:00
Bruno Oliveira b62b549f5f
Preparing release version 5.0.1 (#5557)
Preparing release version 5.0.1
2019-07-05 08:13:37 -03:00
Bruno Oliveira 60a358fa2d
Replace importlib_metadata with importlib.metadata on Python 3.… (#5539)
Replace importlib_metadata with importlib.metadata on Python 3.8+
2019-07-04 21:46:43 -03:00
Bruno Oliveira bb29f31d22 Preparing release version 5.0.1 2019-07-04 20:01:16 -04:00
Bruno Oliveira b1928f878d
Handle xfail(strict=True) properly in --step-wise mode (#5555)
Handle xfail(strict=True) properly in --step-wise mode
2019-07-04 20:50:33 -03:00
Bruno Oliveira 8651d880a0 Handle xfail(strict=True) properly in --step-wise mode
Fix #5547
2019-07-04 20:28:37 -03:00
Bruno Oliveira 95824c588a
Improve quoting in raises match failure message (#5553)
Improve quoting in raises match failure message
2019-07-04 10:25:27 -03:00