24dcc76495 
								
							 
						 
						
							
							
								
								Use a hack to make typing of pytest.fail.Exception & co work  
							
							... 
							
							
							
							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-02-18 23:17:27 +02:00  
				
					
						
							
							
								 
						
							
								3d2680b31b 
								
							 
						 
						
							
							
								
								Fix type of pytest.warns, and fix check_untyped_defs in test_recwarn  
							
							... 
							
							
							
							The expected_warning is optional. 
							
						 
						
							2020-01-19 19:39:14 +02:00  
				
					
						
							
							
								 
						
							
								866904ab80 
								
							 
						 
						
							
							
								
								Revert "Let context-managers for raises and warns handle unknown keyword arguments"  
							
							... 
							
							
							
							This reverts commit dfe54cd82f 
							
						 
						
							2019-07-14 14:28:21 +03:00  
				
					
						
							
							
								 
						
							
								279733a30b 
								
							 
						 
						
							
							
								
								Remove support for 'code as string' from pytest.raises and pytest.warns  
							
							
							
						 
						
							2019-06-30 11:40:24 -03:00  
				
					
						
							
							
								 
						
							
								a91fe1fedd 
								
							 
						 
						
							
							
								
								pre-commit run pyupgrade --all-files  
							
							
							
						 
						
							2019-06-03 12:08:02 -03:00  
				
					
						
							
							
								 
						
							
								3f1ec520fc 
								
							 
						 
						
							
							
								
								pre-commit run reorder-python-imports --all-files  
							
							
							
						 
						
							2019-06-03 12:08:01 -03:00  
				
					
						
							
							
								 
						
							
								5034399d7a 
								
							 
						 
						
							
							
								
								pre-commit run fix-encoding-pragma --all-files  
							
							
							
						 
						
							2019-06-03 12:08:01 -03:00  
				
					
						
							
							
								 
						
							
								dc75b6af47 
								
							 
						 
						
							
							
								
								Use fix-encoding-pragma pre-commit hook  
							
							
							
						 
						
							2019-05-14 15:56:31 -07:00  
				
					
						
							
							
								 
						
							
								f1183c2422 
								
							 
						 
						
							
							
								
								Remove the 'issue' marker from test suite  
							
							... 
							
							
							
							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 
							
						 
						
							2019-05-09 19:36:38 -03:00  
				
					
						
							
							
								 
						
							
								1bba0a9714 
								
							 
						 
						
							
							
								
								Deprecate `raises(..., 'code(as_a_string)')` / `warns(..., 'code(as_a_string)')  
							
							
							
						 
						
							2018-11-29 09:34:51 -08:00  
				
					
						
							
							
								 
						
							
								ce0b0518c7 
								
							 
						 
						
							
							
								
								fix   #4243  - support positional argument stacklevel on python2  
							
							
							
						 
						
							2018-10-26 09:01:25 +02:00  
				
					
						
							
							
								 
						
							
								2368fbb63c 
								
							 
						 
						
							
							
								
								Apply reorder-python-imports to all files  
							
							
							
						 
						
							2018-10-25 00:01:29 -07:00  
				
					
						
							
							
								 
						
							
								1b51497936 
								
							 
						 
						
							
							
								
								[WIP] Update warning stacklevel when wrapping warnings.warn  
							
							
							
						 
						
							2018-10-18 02:36:41 +00:00  
				
					
						
							
							
								 
						
							
								e0f6fce9e9 
								
							 
						 
						
							
							
								
								In python2, display previously warned warnings  
							
							
							
						 
						
							2018-10-10 09:37:21 -07:00  
				
					
						
							
							
								 
						
							
								aeb92accb2 
								
							 
						 
						
							
							
								
								Implement pytest.deprecated_call with pytest.warns  
							
							
							
						 
						
							2018-10-10 08:03:23 -07:00  
				
					
						
							
							
								 
						
							
								4592def14d 
								
							 
						 
						
							
							
								
								Improve test_rewarn_functional  
							
							
							
						 
						
							2018-09-04 17:02:56 -03:00  
				
					
						
							
							
								 
						
							
								cbaa7dd56a 
								
							 
						 
						
							
							
								
								Upgrade pre-commit hooks except pyupgrade  
							
							
							
						 
						
							2018-06-26 06:35:27 -07:00  
				
					
						
							
							
								 
						
							
								703e4b11ba 
								
							 
						 
						
							
							
								
								run black  
							
							
							
						 
						
							2018-05-23 16:48:46 +02:00  
				
					
						
							
							
								 
						
							
								a5d9fbe2b0 
								
							 
						 
						
							
							
								
								Change pytest.raises to use match instead of matches  
							
							
							
						 
						
							2018-03-27 20:24:15 -07:00  
				
					
						
							
							
								 
						
							
								90a8faabba 
								
							 
						 
						
							
							
								
								Fix test for py37  
							
							... 
							
							
							
							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-30 20:33:07 -02:00  
				
					
						
							
							
								 
						
							
								bd1d17e8de 
								
							 
						 
						
							
							
								
								Replace py.std with stdlib imports  
							
							
							
						 
						
							2018-01-09 12:44:10 -08:00  
				
					
						
							
							
								 
						
							
								983a09a2d4 
								
							 
						 
						
							
							
								
								Merge remote-tracking branch 'upstream/master' into merge-master-into-features  
							
							
							
						 
						
							2017-11-10 18:33:02 -02:00  
				
					
						
							
							
								 
						
							
								03829fde8a 
								
							 
						 
						
							
							
								
								Fix linting E741: ambiguous variable name  
							
							
							
						 
						
							2017-11-04 13:59:10 -02:00  
				
					
						
							
							
								 
						
							
								aa6a67044f 
								
							 
						 
						
							
							
								
								Add match_regex functionality to warns  
							
							
							
						 
						
							2017-09-07 09:58:03 +02:00  
				
					
						
							
							
								 
						
							
								d8ecca5ebd 
								
							 
						 
						
							
							
								
								Add test to design warns signature in TDD mimicking raises signature  
							
							
							
						 
						
							2017-09-04 15:26:00 +02:00  
				
					
						
							
							
								 
						
							
								0726d9a09f 
								
							 
						 
						
							
							
								
								Turn warnings into errors in pytest's own test suite  
							
							... 
							
							
							
							Fix  #2588  
						
							2017-07-22 21:44:18 -03:00  
				
					
						
							
							
								 
						
							
								85141a419f 
								
							 
						 
						
							
							
								
								Fixed E701 flake8 errors  
							
							... 
							
							
							
							multiple statements on one line (colon) 
							
						 
						
							2017-07-17 01:44:23 +02:00  
				
					
						
							
							
								 
						
							
								7248b759e8 
								
							 
						 
						
							
							
								
								Fixed E303 flake8 errors  
							
							... 
							
							
							
							too many blank lines (3) 
							
						 
						
							2017-07-17 01:44:23 +02:00  
				
					
						
							
							
								 
						
							
								620ba5971f 
								
							 
						 
						
							
							
								
								deprecated_call context manager captures warnings already raised  
							
							... 
							
							
							
							Fix  #2469  
						
							2017-06-06 22:40:04 -03:00  
				
					
						
							
							
								 
						
							
								1dee443c2b 
								
							 
						 
						
							
							
								
								Merge pull request  #2445  from nicoddemus/warnings-remove-filter  
							
							... 
							
							
							
							No longer override existing warning filters during warnings capture 
							
						 
						
							2017-05-30 18:14:01 -03:00  
				
					
						
							
							
								 
						
							
								32e2642233 
								
							 
						 
						
							
							
								
								No longer override existing warning filters during warnings capture  
							
							... 
							
							
							
							Fix  #2430  
						
							2017-05-30 17:17:36 -03:00  
				
					
						
							
							
								 
						
							
								f96a1d89c5 
								
							 
						 
						
							
							
								
								pytest.deprecated_call now captures PendingDeprecationWarning in context manager form  
							
							... 
							
							
							
							Fix  #2441  
						
							2017-05-30 12:52:18 -03:00  
				
					
						
							
							
								 
						
							
								9f85584656 
								
							 
						 
						
							
							
								
								Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings  
							
							
							
						 
						
							2017-03-20 19:59:05 -03:00  
				
					
						
							
							
								 
						
							
								42a5d6bdfa 
								
							 
						 
						
							
							
								
								Add __future__ imports to all pytest modules  
							
							... 
							
							
							
							This prevents silly errors from creeping in Python 2 when testing in Python 3 
							
						 
						
							2017-03-16 22:45:40 -03:00  
				
					
						
							
							
								 
						
							
								be5db6fa22 
								
							 
						 
						
							
							
								
								Capture warnings around the entire runtestprotocol  
							
							... 
							
							
							
							This is necessary for the warnings plugin to play nice with the
recwarn fixture 
							
						 
						
							2017-03-16 21:54:41 -03:00  
				
					
						
							
							
								 
						
							
								3c07072bfd 
								
							 
						 
						
							
							
								
								Fix test_recwarn in Python 3.6  
							
							... 
							
							
							
							No longer test for implementation details of recwarn since warnings.catch_warnings has changed
significantly in 3.6. 
							
						 
						
							2017-03-13 19:52:35 -03:00  
				
					
						
							
							
								 
						
							
								22864b75ee 
								
							 
						 
						
							
							
								
								Refactor recwarn to use warnings.catch_warnings instead of custom code  
							
							... 
							
							
							
							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-03-13 19:28:36 -03:00  
				
					
						
							
							
								 
						
							
								43662ce789 
								
							 
						 
						
							
							
								
								allow error message matching in pytest.raises  
							
							
							
						 
						
							2017-02-02 19:52:33 +01:00  
				
					
						
							
							
								 
						
							
								7930a8373d 
								
							 
						 
						
							
							
								
								Newline for flake8  
							
							
							
						 
						
							2017-01-03 10:57:19 -02:00  
				
					
						
							
							
								 
						
							
								0bd8159b60 
								
							 
						 
						
							
							
								
								Add a test when multiple classes are specified in warns  
							
							
							
						 
						
							2017-01-03 10:57:19 -02:00  
				
					
						
							
							
								 
						
							
								6fd0394c63 
								
							 
						 
						
							
							
								
								pytest.warns checks for subclass relationship  
							
							... 
							
							
							
							rather than class equality. This makes it more similar to
pytest.raises. 
							
						 
						
							2017-01-03 10:57:19 -02:00  
				
					
						
							
							
								 
						
							
								402fbe503a 
								
							 
						 
						
							
							
								
								Merge branch 'master' into merge-master-into-features  
							
							
							
						 
						
							2016-12-27 23:31:26 -02:00  
				
					
						
							
							
								 
						
							
								c5f0b751f4 
								
							 
						 
						
							
							
								
								Improve error message when pytest.warns fail  
							
							... 
							
							
							
							The error message contains the expected type of warnings and the
warnings that were captured. Add tests. 
							
						 
						
							2016-12-20 13:45:39 +01:00  
				
					
						
							
							
								 
						
							
								e9668d75b8 
								
							 
						 
						
							
							
								
								turn RecordedWarning into a namedtuple  
							
							... 
							
							
							
							fixes  #2013  
						
							2016-10-24 15:23:53 +02:00  
				
					
						
							
							
								 
						
							
								86b6ce5042 
								
							 
						 
						
							
							
								
								Merge remote-tracking branch 'upstream/master' into merge-master-into-features  
							
							
							
						 
						
							2015-12-10 19:41:14 -02:00  
				
					
						
							
							
								 
						
							
								1c46462991 
								
							 
						 
						
							
							
								
								Fix deprecated_call regression introduced in 2.8.4  
							
							... 
							
							
							
							Fix  #1238  
						
							2015-12-08 22:40:05 -02:00  
				
					
						
							
							
								 
						
							
								5ccb7b1ced 
								
							 
						 
						
							
							
								
								update test_recwarn to new style  
							
							
							
						 
						
							2015-12-08 11:08:33 -08:00  
				
					
						
							
							
								 
						
							
								eabf2f9091 
								
							 
						 
						
							
							
								
								Merge branch 'master' into features  
							
							... 
							
							
							
							Conflicts:
	AUTHORS
	_pytest/__init__.py
	_pytest/hookspec.py
	_pytest/recwarn.py
	testing/test_recwarn.py 
							
						 
						
							2015-12-07 14:28:59 -08:00  
				
					
						
							
							
								 
						
							
								603d81ef2f 
								
							 
						 
						
							
							
								
								deprecated_call now uses monkey patching strategy to capture warnings  
							
							... 
							
							
							
							similar to what we had in 2.7, with a few enhancements
Fix  #1190  
							
						 
						
							2015-11-26 16:48:58 -02:00  
				
					
						
							
							
								 
						
							
								cb58eaa611 
								
							 
						 
						
							
							
								
								Merge remote-tracking branch 'upstream/master' into features  
							
							... 
							
							
							
							Conflicts:
	_pytest/__init__.py
	testing/test_recwarn.py 
							
						 
						
							2015-09-29 15:56:41 +02:00