Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: selenium seems not to close /dev/null at the end of the session #12650

Closed
stefanoborini opened this issue Aug 31, 2023 · 7 comments
Closed

Comments

@stefanoborini
Copy link

What happened?

Not sure if this is a chromedriver issue or a selenium issue, but I suspect selenium.

/dev/null seems to be dangling open at the end of a pytest run with a trivial driver creation in a fixture.

How can we reproduce the issue?

import pytest                                                                             
from selenium import webdriver                                                            
                                                                                          
@pytest.fixture                                                                           
def driver():                                                                             
    driver = webdriver.Chrome()                                                           
    try:                                                                                  
        yield driver                                                                      
    finally:                                                                              
        driver.close()                                                                    
                                                                                          
def test_xxx(driver):                                                                     
    print(driver)

Relevant log output

Platform darwin -- Python 3.11.3, pytest-7.4.0, pluggy-1.0.0
rootdir: <redacted>
configfile: pytest.ini
plugins: xprocess-0.22.2, order-1.2.dev0, dependency-0.5.1, xdist-3.3.1, jira-xray-0.8.9
collected 1 item                                                                                                                                                                                                            

test_xxx.py <selenium.webdriver.chrome.webdriver.WebDriver (session="4f13dd17af93af529736ef6c5e12813b")>
.Exception ignored in: <_io.FileIO name='/dev/null' mode='wb' closefd=True>
Traceback (most recent call last):
  File "<redacted>/python3.11/site-packages/_pytest/runner.py", line 139, in runtestprotocol
    item.funcargs = None  # type: ignore[attr-defined]
    ^^^^^^^^^^^^^
ResourceWarning: unclosed file <_io.BufferedWriter name='/dev/null'>

Operating System

macOS 13.5.1

Selenium version

selenium==4.11.2 on python 3.11

What are the browser(s) and version(s) where you see this issue?

Chrome 116.0.5845.110

What are the browser driver(s) and version(s) where you see this issue?

Downloaded by selenium

Are you using Selenium Grid?

No response

@github-actions
Copy link

@stefanoborini, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

We're working on that in this #12637

@graingert
Copy link
Contributor

graingert commented Dec 18, 2023

@graingert
Copy link
Contributor

Actually could this be a different issue?

self._log_file = log_file or open(os.devnull, "wb")

@graingert
Copy link
Contributor

yeah sorry this is a different issue #13328

@graingert
Copy link
Contributor

@titusfortner I think you can close this one?

@diemol diemol closed this as completed Dec 19, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants