merge
This commit is contained in:
		
						commit
						983b2d2475
					
				|  | @ -1,6 +1,8 @@ | ||||||
| Changes between 2.3.2 and 2.3.3.dev | Changes between 2.3.2 and 2.3.3.dev | ||||||
| ----------------------------------- | ----------------------------------- | ||||||
| 
 | 
 | ||||||
|  | - fix issue 214: gracefully handle proxy objects that | ||||||
|  |   look like fixtures but raise exceptions on introspection | ||||||
| - fix issue213 - allow to parametrize with values like numpy arrays that | - fix issue213 - allow to parametrize with values like numpy arrays that | ||||||
|   do not support an __eq__ operator  |   do not support an __eq__ operator  | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1551,7 +1551,15 @@ class FixtureManager: | ||||||
|                 continue |                 continue | ||||||
|             # fixture functions have a pytest_funcarg__ prefix (pre-2.3 style) |             # fixture functions have a pytest_funcarg__ prefix (pre-2.3 style) | ||||||
|             # or are "@pytest.fixture" marked |             # or are "@pytest.fixture" marked | ||||||
|             marker = getattr(obj, "_pytestfixturefunction", None) |             try: | ||||||
|  |                 marker = getattr(obj, "_pytestfixturefunction", None) | ||||||
|  |             except RuntimeError: | ||||||
|  |                 # some proxy objects raise RuntimeError | ||||||
|  |                 # flasks request globals are one example | ||||||
|  |                 # those aren't fixture functions, so we can ignore | ||||||
|  |                 # XXX: maybe trace it when it happens? | ||||||
|  |                 marker = None | ||||||
|  | 
 | ||||||
|             if marker is None: |             if marker is None: | ||||||
|                 if not name.startswith(self._argprefix): |                 if not name.startswith(self._argprefix): | ||||||
|                     continue |                     continue | ||||||
|  |  | ||||||
|  | @ -1611,6 +1611,34 @@ def test_funcarg_lookup_error(testdir): | ||||||
|     ]) |     ]) | ||||||
|     assert "INTERNAL" not in result.stdout.str() |     assert "INTERNAL" not in result.stdout.str() | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | def test_funcarg_fixture_discovery_failure_issue214(testdir): | ||||||
|  |     # some proxy objects raise RuntimeError on getattr | ||||||
|  |     # for example flask.request | ||||||
|  |     p = testdir.makepyfile(""" | ||||||
|  | 
 | ||||||
|  |         class EvilObject(object): | ||||||
|  |             def __call__(self):  | ||||||
|  |                 #needed to trick discovery | ||||||
|  |                 pass | ||||||
|  |             def __getattr__(self, arg): | ||||||
|  |                 raise RuntimeError('uhm ' + arg) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         fixture = EvilObject() | ||||||
|  |          | ||||||
|  |         def test_1(): | ||||||
|  |             pass | ||||||
|  |     """) | ||||||
|  |     result = testdir.runpytest('--fulltrace') | ||||||
|  |     result.stdout.fnmatch_lines([ | ||||||
|  |         '*1 passed*' | ||||||
|  |     ]) | ||||||
|  |     assert "INTERNAL" not in result.stdout.str() | ||||||
|  |     assert "ERROR" not in result.stdout.str() | ||||||
|  |          | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| class TestReportInfo: | class TestReportInfo: | ||||||
|     def test_itemreport_reportinfo(self, testdir, linecomp): |     def test_itemreport_reportinfo(self, testdir, linecomp): | ||||||
|         testdir.makeconftest(""" |         testdir.makeconftest(""" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue