robotframework / SeleniumLibrary

Web testing library for Robot Framework
Apache License 2.0
1.36k stars 751 forks source link

Create Webdriver has mutable default value #1817

Closed Snooz82 closed 7 months ago

Snooz82 commented 1 year ago

In src/SeleniumLibrary/keywords/browsermanagement.py

    @keyword
    def create_webdriver(
        self, driver_name: str, alias: Optional[str] = None, kwargs={}, **init_kwargs
    ) -> str:

the dictionary in kwargs should be replaced by None

https://florimond.dev/en/posts/2018/08/python-mutable-defaults-are-the-source-of-all-evil/

emanlove commented 1 year ago

René, do you catch this with a linker/black?

Snooz82 commented 1 year ago

@emanlove yes linter do catch this.

i can highly recommend ruff as a linter. It is amazingly fast and replaces isort and works well with black.

you can start with the config that Browser lib has in its pyproject.toml.

emanlove commented 7 months ago

Fixed in #1859