perform state setup finalization earlier
--HG-- branch : 1.0.x
This commit is contained in:
		
							parent
							
								
									4ab0f25b05
								
							
						
					
					
						commit
						7602096f81
					
				|  | @ -4,6 +4,8 @@ Changes between 1.0.0b3 and 1.0.0 | ||||||
| * remove scope-argument from request.addfinalizer() because  | * remove scope-argument from request.addfinalizer() because  | ||||||
|   request.cached_setup has the scope arg. TOOWTDI.  |   request.cached_setup has the scope arg. TOOWTDI.  | ||||||
| 
 | 
 | ||||||
|  | * perform setup finalization before reporting failures | ||||||
|  | 
 | ||||||
| Changes between 1.0.0b1 and 1.0.0b3 | Changes between 1.0.0b1 and 1.0.0b3 | ||||||
| ============================================= | ============================================= | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -19,11 +19,14 @@ def pytest_addoption(parser): | ||||||
|                action="store_true", dest="boxed", default=False, |                action="store_true", dest="boxed", default=False, | ||||||
|                help="box each test run in a separate process")  |                help="box each test run in a separate process")  | ||||||
| 
 | 
 | ||||||
|  | # XXX move to pytest_sessionstart and fix py.test owns tests  | ||||||
| def pytest_configure(config): | def pytest_configure(config): | ||||||
|     config._setupstate = SetupState() |     config._setupstate = SetupState() | ||||||
| 
 | 
 | ||||||
| def pytest_unconfigure(config): | def pytest_sessionfinish(session, exitstatus, excrepr=None): | ||||||
|     config._setupstate.teardown_all() |     # XXX see above | ||||||
|  |     if hasattr(session.config, '_setupstate'): | ||||||
|  |         session.config._setupstate.teardown_all() | ||||||
| 
 | 
 | ||||||
| def pytest_make_collect_report(collector): | def pytest_make_collect_report(collector): | ||||||
|     call = collector.config.guardedcall( |     call = collector.config.guardedcall( | ||||||
|  |  | ||||||
|  | @ -227,7 +227,8 @@ class TerminalReporter: | ||||||
|         for i, testarg in py.builtin.enumerate(self.config.args): |         for i, testarg in py.builtin.enumerate(self.config.args): | ||||||
|             self.write_line("test object %d: %s" %(i+1, testarg)) |             self.write_line("test object %d: %s" %(i+1, testarg)) | ||||||
| 
 | 
 | ||||||
|     def pytest_sessionfinish(self, session, exitstatus, excrepr=None): |     def pytest_sessionfinish(self, __call__, session, exitstatus, excrepr=None): | ||||||
|  |         __call__.execute()  | ||||||
|         self._tw.line("") |         self._tw.line("") | ||||||
|         if exitstatus in (0, 1, 2): |         if exitstatus in (0, 1, 2): | ||||||
|             self.summary_failures() |             self.summary_failures() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue