Commit Graph

10795 Commits

Author SHA1 Message Date
Anthony Sottile f1332872a6
Merge pull request #5611 from mxr/patch-1
Remove language_version specification in black hooks
2019-07-16 10:15:28 -07:00
Bruno Oliveira ac12245f5f
Merge pull request #5612 from The-Compiler/new-trainings-2
Remove Europython training
2019-07-16 14:00:04 -03:00
Florian Bruhin d9eab12ee0 Remove Europython training 2019-07-16 15:03:54 +02:00
Max R 2e756d698b
Remove language_version specification in black hooks
Resolves #3840
2019-07-16 08:32:24 -04:00
Bruno Oliveira 15e235c63e
Remove obsolete "importorskip('unittest.mock')" calls (#5608)
Remove obsolete "importorskip('unittest.mock')" calls
2019-07-16 04:41:58 -03:00
Bruno Oliveira 65c23017c7 Update test_getfuncargnames_patching to work with modern mock 2019-07-15 12:23:59 -03:00
Tim Hoffmann bb7608c56f Change section titles in docs 2019-07-15 16:25:33 +02:00
Bruno Oliveira 8a3f40996a Remove obsolete "importorskip('unittest.mock')" calls 2019-07-15 11:18:05 -03:00
Tim Hoffmann 6f1d358a0c Fix some ReST indentation issues in docstrings 2019-07-15 16:16:44 +02:00
Tim Hoffmann 3ad315bcee Improve CSS layout of API reference 2019-07-15 16:15:59 +02:00
Ran Benita 129600d698 saferepr: Avoid indirect function calls
The DRY savings they provide are rather small, while they make it harder
to type-check, and IMO harder to understand.
2019-07-15 17:07:58 +03:00
Thomas Grainger a96710dd8a
demonstrate ExitStack assuming connect returns a context manager 2019-07-15 14:05:19 +01:00
Bruno Oliveira 54e08b729f
More CSS fine-tuning (#5604)
More CSS fine-tuning
2019-07-15 09:42:18 -03:00
Tim Hoffmann 01606315aa More CSS fine-tuning 2019-07-15 13:40:30 +02:00
Bruno Oliveira 8f2f3bb1fa
Improve CSS layout (#5602)
Improve CSS layout
2019-07-14 19:02:58 -03:00
Bruno Oliveira 499fda2349
Various cleanups in src/_pytest/python.py (#5599)
Various cleanups in src/_pytest/python.py
2019-07-14 19:00:35 -03:00
Ran Benita c7aacc96bb saferepr: Remove unused setting of max_other
max_other is used by the superclass repr_instance, but we override it
and use maxsize instead.
2019-07-14 22:50:14 +03:00
Ran Benita 0394ebffee saferepr: Use an __init__ instead of setting attributes after construction
This will be easier to type-check, and also somewhat clearer.
2019-07-14 22:50:14 +03:00
Ran Benita 0225be53a2 saferepr: Remove dead SafeRepr.repr_unicode
This function is not called anywhere directly, and cannot be called by
the dynamic `repr_<type>()` dispatch mechanism because unicode is no
longer a type in Python 3.
2019-07-14 22:13:57 +03:00
Tim Hoffmann da5add1294 Improve CSS layout 2019-07-14 18:58:07 +02:00
Ran Benita 11f1f79222 Allow creating ExceptionInfo from existing exc_info for better typing
This way the ExceptionInfo generic parameter can be inferred from the
passed-in exc_info. See for example the replaced cast().
2019-07-14 14:28:24 +03:00
Ran Benita 3f1fb62584 Rework ExceptionInfo to not require manual __init__ call
Mypy doesn't like calling __init__() in this way.
2019-07-14 14:28:24 +03:00
Ran Benita 14bf4cdf44 Make ExceptionInfo generic in the exception type
This way, in

    with pytest.raises(ValueError) as cm:
        ...

cm.value is a ValueError and not a BaseException.
2019-07-14 14:28:24 +03:00
Ran Benita 56dcc9e1f8 Type-annotate pytest.raises 2019-07-14 14:28:24 +03:00
Ran Benita 55a570e513 Type-annotate ExceptionInfo 2019-07-14 14:28:24 +03:00
Ran Benita 2dca68b863 Type-annotate pytest.warns 2019-07-14 14:28:24 +03:00
Ran Benita d7ee3dac2c Type-annotate pytest.{exit,skip,fail,xfail,importorskip} 2019-07-14 14:28:24 +03:00
Ran Benita 866904ab80 Revert "Let context-managers for raises and warns handle unknown keyword arguments"
This reverts commit dfe54cd82f.

The idea in the commit was to simplify the code by removing the check
and instead letting it TypeError which has the same effect.

However this type error is caught by mypy, and rather than ignoring the
error we think it's better and clearer to go back to the previous
explicit check.
2019-07-14 14:28:21 +03:00
Ran Benita 35a57a0dfb Use flake8's extend-ignore instead of ignore
extend-ignore adds ignores in addition to flake8's existing ignores.

The default ignores currently are:
E121,E123,E126,E226,E24,E704,W503,W504
2019-07-14 11:12:47 +03:00
Florian Bruhin 6afbac29a3
Merge pull request #5600 from wojtekerbetowski/issues/3404
Add autouse fixture order information (#3404).
2019-07-13 03:22:15 -07:00
Wojtek Erbetowski d23fbab188 Add autouse fixture order information (#3404).
A case with a fixture use both as an autouse and explititly
was raised. This case sounds too narrow to add to documentation
(and could be misleading for people learning pytest with explicitely
using an autouse fixture). At the same time there was no documentation
on the autouse vs regular fixture order, therefore this commit adds
such an information. Code sample grew and it was extracted to the file.
2019-07-13 11:43:47 +02:00
Ronny Pfannschmidt 374c4325a8 refactor finding xunit setup/teardown functions
s/_get_non_fixture_func(obj, name: str)/_get_first_non_fixture_func(obj, names: List[str])/
2019-07-13 08:13:46 +02:00
Ronny Pfannschmidt 2c071a060e refactor resolve_arg_value_types
* more explicit type checks
* expand from list+tuple to sequence
2019-07-13 08:13:46 +02:00
Bruno Oliveira 0f8b462677
Include <testsuites> root tag in generated XML (#5550)
Include <testsuites> root tag in generated XML
2019-07-12 14:35:34 -03:00
Ronny Pfannschmidt 898028cb22 remove unused _get_xunit_setup_teardown 2019-07-12 17:45:23 +02:00
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