Minor adjustments found during code review
This commit is contained in:
		
							parent
							
								
									e0f6fce9e9
								
							
						
					
					
						commit
						bf265a424d
					
				|  | @ -1 +0,0 @@ | ||||||
| ``pytest.warn`` will capture previously-warned warnings in python2.  Previously they were never raised. |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | ``pytest.warn`` will capture previously-warned warnings in Python 2. Previously they were never raised. | ||||||
|  | @ -1 +1,4 @@ | ||||||
| Reimplement ``pytest.deprecated_call`` using ``pytest.warns`` so it supports the ``match='...'`` keyword argument. | Reimplement ``pytest.deprecated_call`` using ``pytest.warns`` so it supports the ``match='...'`` keyword argument. | ||||||
|  | 
 | ||||||
|  | This has the side effect that ``pytest.deprecated_call`` now raises ``pytest.fail.Exception`` instead | ||||||
|  | of ``AssertionError``. | ||||||
|  |  | ||||||
|  | @ -156,18 +156,18 @@ class WarningsRecorder(warnings.catch_warnings): | ||||||
|         if six.PY2: |         if six.PY2: | ||||||
| 
 | 
 | ||||||
|             def warn(*args, **kwargs): |             def warn(*args, **kwargs): | ||||||
|                 return self._warn(*args, **kwargs) |                 return self._saved_warn(*args, **kwargs) | ||||||
| 
 | 
 | ||||||
|             warnings.warn, self._warn = warn, warnings.warn |             warnings.warn, self._saved_warn = warn, warnings.warn | ||||||
|         return self |         return self | ||||||
| 
 | 
 | ||||||
|     def __exit__(self, *exc_info): |     def __exit__(self, *exc_info): | ||||||
|         if not self._entered: |         if not self._entered: | ||||||
|             __tracebackhide__ = True |             __tracebackhide__ = True | ||||||
|             raise RuntimeError("Cannot exit %r without entering first" % self) |             raise RuntimeError("Cannot exit %r without entering first" % self) | ||||||
|         # see above where `self.mp` is assigned |         # see above where `self._saved_warn` is assigned | ||||||
|         if six.PY2: |         if six.PY2: | ||||||
|             warnings.warn = self._warn |             warnings.warn = self._saved_warn | ||||||
|         super(WarningsRecorder, self).__exit__(*exc_info) |         super(WarningsRecorder, self).__exit__(*exc_info) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue