logging: move log_file_handler cleanup from sessionend to unconfigure
It is set-up in configure, so match it.
This commit is contained in:
		
							parent
							
								
									43c465c9bf
								
							
						
					
					
						commit
						bd5e3f042d
					
				|  | @ -678,10 +678,6 @@ class LoggingPlugin: | ||||||
|             with catching_logs(self.log_file_handler, level=self.log_file_level): |             with catching_logs(self.log_file_handler, level=self.log_file_level): | ||||||
|                 yield |                 yield | ||||||
| 
 | 
 | ||||||
|         # Close the FileHandler explicitly. |  | ||||||
|         # (logging.shutdown might have lost the weakref?!) |  | ||||||
|         self.log_file_handler.close() |  | ||||||
| 
 |  | ||||||
|     @pytest.hookimpl(hookwrapper=True, tryfirst=True) |     @pytest.hookimpl(hookwrapper=True, tryfirst=True) | ||||||
|     def pytest_sessionstart(self): |     def pytest_sessionstart(self): | ||||||
|         self.log_cli_handler.set_when("sessionstart") |         self.log_cli_handler.set_when("sessionstart") | ||||||
|  | @ -706,6 +702,12 @@ class LoggingPlugin: | ||||||
|             with catching_logs(self.log_file_handler, level=self.log_file_level): |             with catching_logs(self.log_file_handler, level=self.log_file_level): | ||||||
|                 yield  # run all the tests |                 yield  # run all the tests | ||||||
| 
 | 
 | ||||||
|  |     @pytest.hookimpl | ||||||
|  |     def pytest_unconfigure(self): | ||||||
|  |         # Close the FileHandler explicitly. | ||||||
|  |         # (logging.shutdown might have lost the weakref?!) | ||||||
|  |         self.log_file_handler.close() | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class _LiveLoggingStreamHandler(logging.StreamHandler): | class _LiveLoggingStreamHandler(logging.StreamHandler): | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue