Commit Graph

54 Commits

Author SHA1 Message Date
Ran Benita f00bec2a12 Replace yield_fixture -> fixture in internal code
`yield_fixture` is a deprecated alias to `fixture`.
2020-06-25 14:05:46 +03:00
Bruno Oliveira c229d6f46f Fix mypy checks 2020-06-09 14:48:49 -03:00
ibriquem e2e7f15b71 Make dataclasses/attrs comparison recursive, fixes #4675 2020-06-09 14:39:40 -03:00
Ran Benita 54ad048be7 Enable check_untyped_defs mypy option for testing/ too 2020-06-05 11:34:20 +03:00
Daniel Hahler 8cae78a18b Fix warnings summary
- replace "tests with warnings" with just warnings: they a) might not
  come from a test in the first place, and b) a single test might have
  multiple warnings.
- fix usage of (unused) argument to `collapsed_location_report`

Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-05-05 21:40:34 +03:00
Bruno Oliveira fd2f172258 Let unittest frameworks deal with async functions
Instead of trying to handle unittest-async functions in pytest_pyfunc_call,
let the unittest framework handle them instead.

This lets us remove the hack in pytest_pyfunc_call, with the upside that
we should support any unittest-async based framework.

Also included 'asynctest' as test dependency for py37-twisted, and renamed
'twisted' to 'unittestextras' to better reflect that we install 'twisted' and
'asynctest' now.

This also fixes the problem of cleanUp functions not being properly called
for async functions.

Fix #7110
Fix #6924
2020-05-01 15:10:28 -03:00
Ronny Pfannschmidt 19c243f0fa
Merge pull request #6285 from earonesty/patch-1
Add _pytest.fixtures.FixtureLookupError to top level import
2020-04-10 07:58:58 +02:00
Ronny Pfannschmidt 451aef65ac prepare tests and disable warnings for asyncio unittest cases
shoehorn unittest async results into python test result interpretation

changelog
2020-03-30 21:55:12 +02:00
earonesty 74cdff86f8 Update conftest.py 2020-03-03 09:59:38 -03:00
Ronny Pfannschmidt 23c43a37e0 summarize warning summaries if the number of locations is high 2020-03-01 14:08:15 +01:00
Bruno Oliveira ba76080b59 Validate xunit2 files against the schema
Fix #5095
2019-08-09 10:55:06 -03:00
Bruno Oliveira 31738155b5
Remove deprecated features (#5529)
Remove deprecated features
2019-07-09 19:04:06 -03: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 0ed7aa2db6 Make 'request' a reserved name for fixtures 2019-06-30 13:31:39 -03:00
Anthony Sottile a91fe1fedd pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
Anthony Sottile 5034399d7a pre-commit run fix-encoding-pragma --all-files 2019-06-03 12:08:01 -03:00
Bruno Oliveira 4d49ba6529 Drop Python 2.7 and 3.4 support
* Update setup.py requires and classifiers
* Drop Python 2.7 and 3.4 from CI
* Update docs dropping 2.7 and 3.4 support
* Fix mock imports and remove tests related to pypi's mock module
* Add py27 and 34 support docs to the sidebar
* Remove usage of six from tmpdir
* Remove six.PY* code blocks
* Remove sys.version_info related code
* Cleanup compat
* Remove obsolete safe_str
* Remove obsolete __unicode__ methods
* Remove compat.PY35 and compat.PY36: not really needed anymore
* Remove unused UNICODE_TYPES
* Remove Jython specific code
* Remove some Python 2 references from docs

Related to #5275
2019-06-02 14:39:11 -03:00
Anthony Sottile dc75b6af47 Use fix-encoding-pragma pre-commit hook 2019-05-14 15:56:31 -07:00
Daniel Hahler 0d31e852b1 Run isort 2019-03-01 14:24:18 +01:00
Bruno Oliveira c3d7340542 Fix setUpClass being called in subclasses that were skipped
Fix #4700
2019-01-31 20:24:11 -02:00
Bruno Oliveira 9543d1901f Group warnings by message instead of by test id 2019-01-22 19:42:22 -02:00
Ronny Pfannschmidt f28b834426 fix #4649 - also transfer markers to keywordmapping
as it turns out it is distinct from nodekeywords and behaves completely different
2019-01-18 23:18:51 +01:00
Anthony Sottile 1bba0a9714 Deprecate `raises(..., 'code(as_a_string)')` / `warns(..., 'code(as_a_string)') 2018-11-29 09:34:51 -08:00
Aly Sivji 2bffd6829e Move dataclass tests for 3.7 to separate file 2018-11-12 15:36:16 -06:00
Daniel Hahler a0890f98d8 tests: harden test_config_error 2018-11-09 01:31:53 +01:00
Bruno Oliveira 3b7fbcd47f Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-10-27 14:29:01 -03:00
Anthony Sottile 777e9e1e17 Merge remote-tracking branch 'origin/master' into merge-master 2018-10-25 18:00:39 -07:00
Ronny Pfannschmidt bfa1993840 add script to generate a example folder for collecting many files 2018-10-25 22:07:20 +02:00
Anthony Sottile 2368fbb63c Apply reorder-python-imports to all files 2018-10-25 00:01:29 -07:00
Daniel Hahler eee8201e4f Merge remote-tracking branch 'origin/master' into merge-master 2018-10-24 22:36:34 +02:00
Bruno Oliveira 7bb51b8ceb Issue a warning when a fixture named 'request' is collected
Fix #611
2018-10-20 12:09:44 -03:00
Bruno Oliveira 02ae7d8531 Improve error message when a recursive dependency between fixtures is detected
Fix #2909
2018-10-20 09:44:42 -03:00
Anthony Sottile 1caf6d5907 Upgrade pre-commit hooks 2018-10-08 10:10:46 -07:00
Ronny Pfannschmidt 66609665f2
Merge pull request #4076 from nicoddemus/unittest-param-fixture-msg
Improve error message when TestCase functions use a parametrized fixture
2018-10-06 07:43:57 +02:00
Bruno Oliveira 212937eb3e Improve error message when TestCase functions use a parametrized fixture
Fix #2535
2018-10-03 19:43:46 -03:00
Bruno Oliveira 70c7273640 Fix request.fixturenames to return fixtures created dynamically
Fix #3057
2018-10-03 18:50:14 -03:00
Bruno Oliveira 41f6ea13ce Fix 'Package has no len()' error during collection
Fix #3749
2018-09-20 17:53:21 -03:00
Bruno Oliveira de6f2c0336 Collect tests from __init__.py files if they match 'python_files'
Fix #3773
2018-08-25 11:18:52 -03:00
Ondřej Súkup cd07c4d4ff
Use unittest.mock if is only aviable
from Python 3.3 is mock part of python standard library in unittest namespace
2018-08-22 23:49:40 +02:00
Bruno Oliveira 4d8903fd0b
Merge pull request #3780 from nicoddemus/mock-integration-fix
Fix issue where fixtures would lose the decorated functionality
2018-08-09 12:26:09 -03:00
Bruno Oliveira e723069165
Merge pull request #3771 from nicoddemus/package-infinite-recursion-bug
Fix infinite recursion collection bug with pytest_ignore_collect hook
2018-08-06 10:09:31 -03:00
Bruno Oliveira 2c0d2eef40 Only consider actual functions when considering hooks
Fix #3775
2018-08-04 16:37:07 -03:00
Bruno Oliveira ef8ec01e39 Fix issue where fixtures would lose the decorated functionality
Fix #3774
2018-08-04 15:14:00 -03:00
Bruno Oliveira dcafb8c48c Add example for package recursion bug 2018-08-03 15:40:33 -03:00
Bruno Oliveira e1ad1a14af Add example script and failure for #3742 2018-07-31 17:50:55 -03:00
Bruno Oliveira 011f88f7e7 Deprecate calling fixture functions directly
This will now issue a RemovedInPytest4Warning when the user calls
a fixture function directly, instead of requesting it from test
functions as is expected

Fix #3661
2018-07-26 19:58:42 -03:00
Ronny Pfannschmidt 0fd86ec8a8 move some fill fixture acceptance tests contents to the examples script folder 2018-06-29 10:58:33 +02:00
Ronny Pfannschmidt e860ff7299 port some acceptance tests over to copy_example 2018-06-26 22:59:40 +02:00
Ronny Pfannschmidt 89e0a3ec27 merge from master to features 2018-06-26 17:01:05 +02:00
Bruno Oliveira 9e32b6ae48
Small typo and grammar fix 2018-06-15 15:05:00 -03:00