Skip to content

Pytest --help shows a stack trace ('TerminalReporter' object has no attribute '_sessionstarttime') #3561

Closed
@smanenti

Description

@smanenti

When executing pytest --help, using the latest version of SeleniumBase, a stack trace is reported (as shown below).
The error reported is: AttributeError: 'TerminalReporter' object has no attribute '_sessionstarttime'
In: seleniumbase\plugins\pytest_plugin.py", line 2163, in perform_pytest_unconfigure

(shown according to specified file_or_dir or current dir if not specified; fixtures with leading '_' are only shown with the '-v' option
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Scripts\pytest.exe\__main__.py", line 7, in <module>
    sys.exit(console_main())
             ^^^^^^^^^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\_pytest\config\__init__.py", line 201, in console_main
    code = main()
           ^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\_pytest\config\__init__.py", line 175, in main
    ret: ExitCode | int = config.hook.pytest_cmdline_main(config=config)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\pluggy\_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\_pytest\helpconfig.py", line 156, in pytest_cmdline_main
    config._ensure_unconfigure()
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\_pytest\config\__init__.py", line 1123, in _ensure_unconfigure
    self.hook.pytest_unconfigure(config=self)
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\pluggy\_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\seleniumbase\plugins\pytest_plugin.py", line 2533, in pytest_unconfigure
    _perform_pytest_unconfigure_(config)
  File "C:\Sebastien\GitLab\qa-automations\py\venv\Lib\site-packages\seleniumbase\plugins\pytest_plugin.py", line 2163, in _perform_pytest_unconfigure_
    duration = time.time() - reporter._sessionstarttime
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TerminalReporter' object has no attribute '_sessionstarttime'

Steps to reproduce

  1. Install SeleniumBase
  2. Install Pytest
  3. Execute "pytest --help" from the venv

Expected results

  1. The help is displayed without any error

Actual behavior

  1. An error is thrown

Workaround

  1. No workaround was found.

Metadata

Metadata

Assignees

Labels

bugUh oh... Something needs to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions