Age | Commit message (Collapse) | Author | |
---|---|---|---|
2020-12-05 | Merge pull request #8017 from bluetech/typing-public-fixtures | Ran Benita | |
Export types of builtin fixtures for type annotations | |||
2020-11-16 | testing: convert test_{conftest,recwarn,tmpdir} to pytester | Garvit Shubham | |
2020-11-13 | Export types of builtin fixture for type annotations | Ran Benita | |
In order to allow users to type annotate fixtures they request, the types need to be imported from the `pytest` namespace. They are/were always available to import from the `_pytest` namespace, but that is not guaranteed to be stable. These types are only exported for the purpose of typing. Specifically, the following are *not* public: - Construction (`__init__`) - Subclassing - staticmethods and classmethods We try to combat them being used anyway by: - Marking the classes as `@final` when possible (already done). - Not documenting private stuff in the API Reference. - Using `_`-prefixed names or marking as `:meta private:` for private stuff. - Adding a keyword-only `_ispytest=False` to private constructors, warning if False, and changing pytest itself to pass True. In the future it will (hopefully) become a hard error. Hopefully that will be enough. | |||
2020-06-25 | recwarn: improve return type annotation of non-contextmanager pytest.warns | Ran Benita | |
It returns the return value of the function. | |||
2020-02-18 | Use a hack to make typing of pytest.fail.Exception & co work | Ran Benita | |
Mypy currently is unable to handle assigning attributes on function: https://github.com/python/mypy/issues/2087. pytest uses this for the outcome exceptions -- `pytest.fail.Exception`, `pytest.exit.Exception` etc, and this is the canonical name by which they are referred. Initially we started working around this with type: ignores, and later by switching e.g. `pytest.fail.Exception` with the direct exception `Failed`. But this causes a lot of churn and is not as nice. And I also found that some code relies on it, in skipping.py: def pytest_configure(config): if config.option.runxfail: # yay a hack import pytest old = pytest.xfail config._cleanup.append(lambda: setattr(pytest, "xfail", old)) def nop(*args, **kwargs): pass nop.Exception = xfail.Exception setattr(pytest, "xfail", nop) ... So it seems better to support it. Use a hack to make it work. The rest of the commit rolls back all of the workarounds we added up to now. `pytest.raises.Exception` also exists, but it's not used much so I kept it as-is for now. Hopefully in the future mypy supports this and this ugliness can be removed. | |||
2020-01-19 | Fix type of pytest.warns, and fix check_untyped_defs in test_recwarn | Ran Benita | |
The expected_warning is optional. | |||
2019-07-14 | Revert "Let context-managers for raises and warns handle unknown keyword ↵ | Ran Benita | |
arguments" This reverts commit dfe54cd82f55f17f3c9e6e078325f306a046b93b. 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-06-30 | Remove support for 'code as string' from pytest.raises and pytest.warns | Bruno Oliveira | |
2019-06-03 | pre-commit run pyupgrade --all-files | Anthony Sottile | |
2019-06-03 | pre-commit run reorder-python-imports --all-files | Anthony Sottile | |
2019-06-03 | pre-commit run fix-encoding-pragma --all-files | Anthony Sottile | |
2019-05-14 | Use fix-encoding-pragma pre-commit hook | Anthony Sottile | |
2019-05-09 | Remove the 'issue' marker from test suite | Bruno Oliveira | |
It doesn't seem to add much value (why would one execute tests based on that marker?), plus using the docstring for that encourages one to write a more descriptive message about the test | |||
2018-11-29 | Deprecate `raises(..., 'code(as_a_string)')` / `warns(..., 'code(as_a_string)') | Anthony Sottile | |
2018-10-26 | fix #4243 - support positional argument stacklevel on python2 | Ronny Pfannschmidt | |
2018-10-25 | Apply reorder-python-imports to all files | Anthony Sottile | |
2018-10-18 | [WIP] Update warning stacklevel when wrapping warnings.warn | Ankit Goel | |
2018-10-10 | In python2, display previously warned warnings | Anthony Sottile | |
2018-10-10 | Implement pytest.deprecated_call with pytest.warns | Anthony Sottile | |
2018-09-04 | Improve test_rewarn_functional | Bruno Oliveira | |
2018-06-26 | Upgrade pre-commit hooks except pyupgrade | Anthony Sottile | |
2018-05-23 | run black | Ronny Pfannschmidt | |
2018-03-27 | Change pytest.raises to use match instead of matches | Jeffrey Rackauckas | |
2018-01-30 | Fix test for py37 | Bruno Oliveira | |
In previous Python versions, the list of warnigns appears like: ... list of emitted warnings is: [UserWarning('user',)]. In Python 3.7 apparently the string representation has been improved to: ... list of emitted warnings is: [UserWarning('user')]. Fix #3011 | |||
2018-01-09 | Replace py.std with stdlib imports | Anthony Sottile | |
2017-11-10 | Merge remote-tracking branch 'upstream/master' into merge-master-into-features | Bruno Oliveira | |
2017-11-04 | Fix linting E741: ambiguous variable name | Bruno Oliveira | |
2017-09-07 | Add match_regex functionality to warns | Joan Massich | |
2017-09-04 | Add test to design warns signature in TDD mimicking raises signature | Joan Massich | |
2017-07-22 | Turn warnings into errors in pytest's own test suite | Bruno Oliveira | |
Fix #2588 | |||
2017-07-17 | Fixed E701 flake8 errors | Andras Tim | |
multiple statements on one line (colon) | |||
2017-07-17 | Fixed E303 flake8 errors | Andras Tim | |
too many blank lines (3) | |||
2017-06-06 | deprecated_call context manager captures warnings already raised | Bruno Oliveira | |
Fix #2469 | |||
2017-05-30 | Merge pull request #2445 from nicoddemus/warnings-remove-filter | Bruno Oliveira | |
No longer override existing warning filters during warnings capture | |||
2017-05-30 | No longer override existing warning filters during warnings capture | Bruno Oliveira | |
Fix #2430 | |||
2017-05-30 | pytest.deprecated_call now captures PendingDeprecationWarning in context ↵ | Bruno Oliveira | |
manager form Fix #2441 | |||
2017-03-20 | Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings | Bruno Oliveira | |
2017-03-16 | Add __future__ imports to all pytest modules | Bruno Oliveira | |
This prevents silly errors from creeping in Python 2 when testing in Python 3 | |||
2017-03-16 | Capture warnings around the entire runtestprotocol | Bruno Oliveira | |
This is necessary for the warnings plugin to play nice with the recwarn fixture | |||
2017-03-13 | Fix test_recwarn in Python 3.6 | Bruno Oliveira | |
No longer test for implementation details of recwarn since warnings.catch_warnings has changed significantly in 3.6. | |||
2017-03-13 | Refactor recwarn to use warnings.catch_warnings instead of custom code | Bruno Oliveira | |
Since we dropped 2.5, we can now use warnings.catch_warnings to do the "catch warnings" magic for us, simplifying the code a bit. | |||
2017-02-02 | allow error message matching in pytest.raises | Thomas Kriechbaumer | |
2017-01-03 | Newline for flake8 | Loïc Estève | |
2017-01-03 | Add a test when multiple classes are specified in warns | Loïc Estève | |
2017-01-03 | pytest.warns checks for subclass relationship | Loïc Estève | |
rather than class equality. This makes it more similar to pytest.raises. | |||
2016-12-27 | Merge branch 'master' into merge-master-into-features | Bruno Oliveira | |
2016-12-20 | Improve error message when pytest.warns fail | Loïc Estève | |
The error message contains the expected type of warnings and the warnings that were captured. Add tests. | |||
2016-10-24 | turn RecordedWarning into a namedtuple | Ronny Pfannschmidt | |
fixes #2013 | |||
2015-12-10 | Merge remote-tracking branch 'upstream/master' into merge-master-into-features | Bruno Oliveira | |
2015-12-08 | Fix deprecated_call regression introduced in 2.8.4 | Bruno Oliveira | |
Fix #1238 |