2

enter image description here

As shown on the screenshot above: my pytest-html report gives me both "Captured stdout setup" and "Captured log setup" when driver instance is created. Is there a way to turn it off so it's not redundant?

 -----------------------------Captured stdout setup------------------------------ 
 

 -----------------------------Captured stderr setup------------------------------ 
[WDM] - Current google-chrome version is 87.0.4280
[WDM] - Get LATEST driver version for 87.0.4280
[WDM] - Driver [C:\Users\olga\.wdm\drivers\chromedriver\win32\87.0.4280.88\chromedriver.exe] found in cache

 -------------------------------Captured log setup------------------------------- 
INFO     WDM:logger.py:24 Current google-chrome version is 87.0.4280
INFO     WDM:logger.py:14 Get LATEST driver version for 87.0.4280
INFO     WDM:logger.py:14 Driver [C:\Users\olga\.wdm\drivers\chromedriver\win32\87.0.4280.88\chromedriver.exe] found in cache
justMe
  • 45
  • 4
  • Don't register the `StreamHandler` when running tests? – hoefling Dec 16 '20 at 15:26
  • @hoefling I am not, I only use logger.addHandler(file_handler), not StreamHandler. Or should I specify removeHandler for StreamHandler? – justMe Dec 16 '20 at 16:06
  • It can also be `logging.basicConfig` etc. can you add a [mcve]? – hoefling Dec 16 '20 at 17:35
  • The thing is I can't reproduce it on a small example without inheritance etc - it's still going to be quite big chunk of code. When I put everything into one .py file it doesn't print a bunch of stuff on my report file :/ – justMe Dec 17 '20 at 10:14

1 Answers1

0

Kind of a workaround but solved my problem:

I moved creating the driver instance and using the fixture to a separate file Base Test - and my test class inherits it instead of using @pytest.usefixtures decorator

import pytest
@pytest.mark.usefixtures("driver_setup")
class BaseTest:
    pass
justMe
  • 45
  • 4