parent
							
								
									1e84a3c451
								
							
						
					
					
						commit
						4a70a667bb
					
				|  | @ -49,9 +49,9 @@ class PluginHooks: | |||
|     def pytest_collect_directory(self, path, parent): | ||||
|         """ return Collection node or None. """ | ||||
| 
 | ||||
|     def pytest_pymodule_makeitem(self, modcol, name, obj): | ||||
|     def pytest_pycollect_obj(self, collector, name, obj): | ||||
|         """ return custom item/collector for a python object in a module, or None.  """ | ||||
|     pytest_pymodule_makeitem.firstresult = True | ||||
|     pytest_pycollect_obj.firstresult = True | ||||
| 
 | ||||
|     def pytest_collectstart(self, collector): | ||||
|         """ collector starts collecting. """ | ||||
|  |  | |||
|  | @ -18,9 +18,9 @@ import py | |||
| class UnittestPlugin: | ||||
|     """ discover and integrate traditional ``unittest.py`` tests.  | ||||
|     """ | ||||
|     def pytest_pymodule_makeitem(self, modcol, name, obj): | ||||
|     def pytest_pycollect_obj(self, collector, name, obj): | ||||
|         if py.std.inspect.isclass(obj) and issubclass(obj, py.std.unittest.TestCase): | ||||
|             return UnitTestCase(name, parent=modcol) | ||||
|             return UnitTestCase(name, parent=collector) | ||||
| 
 | ||||
| class UnitTestCase(py.test.collect.Class): | ||||
|     def collect(self): | ||||
|  |  | |||
|  | @ -135,8 +135,8 @@ class PyCollectorMixin(PyobjMixin, py.test.collect.Collector): | |||
|             return self.join(name) | ||||
| 
 | ||||
|     def makeitem(self, name, obj): | ||||
|         res = self.config.hook.pytest_pymodule_makeitem( | ||||
|             modcol=self, name=name, obj=obj) | ||||
|         res = self.config.hook.pytest_pycollect_obj( | ||||
|             collector=self, name=name, obj=obj) | ||||
|         if res: | ||||
|             return res | ||||
|         if (self.classnamefilter(name)) and \ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue