Add patch to fix tests with pytest3
This commit is contained in:
		
							parent
							
								
									7d952350fb
								
							
						
					
					
						commit
						50f0b6c6bc
					
				
							
								
								
									
										21
									
								
								fix-for-pytest3.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								fix-for-pytest3.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| diff --git a/test_pytest_mock.py b/test_pytest_mock.py
 | ||||
| index 1e47d0e..e54649a 100644
 | ||||
| --- a/test_pytest_mock.py
 | ||||
| +++ b/test_pytest_mock.py
 | ||||
| @@ -176,7 +176,7 @@ def __test_failure_message(self, mocker, **kwargs):
 | ||||
|          stub = mocker.stub(**kwargs) | ||||
|          with pytest.raises(AssertionError) as exc_info: | ||||
|              stub.assert_called_with() | ||||
| -        assert exc_info.value.msg == expected_message
 | ||||
| +        assert str(exc_info.value) == expected_message
 | ||||
|   | ||||
|      def test_failure_message_with_no_name(self, mocker): | ||||
|          self.__test_failure_message(mocker) | ||||
| @@ -352,7 +352,7 @@ def assert_argument_introspection(left, right):
 | ||||
|          #       test was run by examining sys.argv | ||||
|          verbose = any(a.startswith('-v') for a in sys.argv) | ||||
|          expected = '\n  '.join(util._compare_eq_iterable(left, right, verbose)) | ||||
| -        assert expected in e.msg
 | ||||
| +        assert expected in str(e)
 | ||||
|      else: | ||||
|          raise AssertionError("DID NOT RAISE") | ||||
| @ -7,12 +7,14 @@ to worry about undoing patches at the end of a test. | ||||
| 
 | ||||
| Name:           python-%{pypi_name} | ||||
| Version:        1.2 | ||||
| Release:        1%{?dist} | ||||
| Release:        2%{?dist} | ||||
| Summary:        Thin-wrapper around the mock package for easier use with py.test | ||||
| 
 | ||||
| License:        MIT | ||||
| URL:            https://pypi.python.org/pypi/pytest-mock | ||||
| Source0:        https://pypi.python.org/packages/30/11/a5a8009eff04bc15c37e2f8e33d8ed99adf828ec8f551fb31d99f6c73b5b/pytest-mock-1.2.zip | ||||
| # From: https://github.com/pytest-dev/pytest-mock/pull/63 | ||||
| Patch0:         fix-for-pytest3.patch | ||||
| BuildArch:      noarch | ||||
| 
 | ||||
| %description | ||||
| @ -48,6 +50,7 @@ Requires:       python3-pytest >= 2.7 | ||||
| %prep | ||||
| %setup -qn %{pypi_name}-%{version} | ||||
| rm -rf *.egg-info | ||||
| patch -p1 --binary < %{PATCH0} | ||||
| 
 | ||||
| # Correct end of line encoding for README | ||||
| sed -i 's/\r$//' README.rst | ||||
| @ -84,6 +87,9 @@ PYTHONPATH="$(pwd)" py.test-%{python3_version} test_pytest_mock.py | ||||
| 
 | ||||
| 
 | ||||
| %changelog | ||||
| * Sat Oct 01 2016 Julien Enselme <jujens@jujens.eu> - 1.2-2 | ||||
| - Add patch to fix tests with pytest3 | ||||
| 
 | ||||
| * Sun Sep 18 2016 Julien Enselme <jujens@jujens.eu> - 1.2-1 | ||||
| - Update to 1.2 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user