fix issue 179 - propperly show the dependency chain of factories on setup failure
This commit is contained in:
		
							parent
							
								
									503addbf09
								
							
						
					
					
						commit
						e876ad9abd
					
				|  | @ -35,6 +35,8 @@ Changes between 2.2.4 and 2.3.0.dev | ||||||
| 
 | 
 | ||||||
| - fix issue128: show captured output when capsys/capfd are used | - fix issue128: show captured output when capsys/capfd are used | ||||||
| 
 | 
 | ||||||
|  | - fix issue179: propperly show the dependency chain of factories | ||||||
|  | 
 | ||||||
| - pluginmanager.register(...) now raises ValueError if the | - pluginmanager.register(...) now raises ValueError if the | ||||||
|   plugin has been already registered or the name is taken |   plugin has been already registered or the name is taken | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1211,8 +1211,14 @@ class FuncargLookupErrorRepr(TerminalRepr): | ||||||
| 
 | 
 | ||||||
|     def toterminal(self, tw): |     def toterminal(self, tw): | ||||||
|         tw.line() |         tw.line() | ||||||
|         for line in self.factblines or []: |         if self.factblines: | ||||||
|             tw.line(line) |             tw.line('    dependency of:') | ||||||
|  |             for factorydef in self.factblines: | ||||||
|  |                 tw.line('        %s in %s' % ( | ||||||
|  |                     factorydef.argname, | ||||||
|  |                     factorydef.baseid, | ||||||
|  |                 )) | ||||||
|  |             tw.line() | ||||||
|         for line in self.deflines: |         for line in self.deflines: | ||||||
|             tw.line("    " + line.strip()) |             tw.line("    " + line.strip()) | ||||||
|         for line in self.errorstring.split("\n"): |         for line in self.errorstring.split("\n"): | ||||||
|  |  | ||||||
|  | @ -1664,8 +1664,7 @@ class TestFuncargFactory: | ||||||
|             "*2 passed*" |             "*2 passed*" | ||||||
|         ]) |         ]) | ||||||
| 
 | 
 | ||||||
|     @pytest.mark.xfail(reason="factorydef passed to tw.line") |     def test_factory_uses_unknown_funcarg_as_dependency_error(self, testdir): | ||||||
|     def test_factory_uses_unknown_funcarg_error(self, testdir): |  | ||||||
|         testdir.makepyfile(""" |         testdir.makepyfile(""" | ||||||
|             import pytest |             import pytest | ||||||
| 
 | 
 | ||||||
|  | @ -1682,7 +1681,10 @@ class TestFuncargFactory: | ||||||
|             """) |             """) | ||||||
|         result = testdir.runpytest() |         result = testdir.runpytest() | ||||||
|         result.stdout.fnmatch_lines([ |         result.stdout.fnmatch_lines([ | ||||||
|             "*LookupError: no factory found for argument 'missing'" |             "*dependency of:*", | ||||||
|  |             "*call_fail*", | ||||||
|  |             "*def fail(*", | ||||||
|  |             "*LookupError: no factory found for argument 'missing'", | ||||||
|         ]) |         ]) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue