Skip to content

basic example warning and some questions  #337

@catafest-work

Description

@catafest-work

I tested this :

import pytest
import warnings
from pylenium.driver import Pylenium
from pylenium.config import PyleniumConfig

# Ignoră warning-urile specifice
warnings.filterwarnings("ignore", category=pytest.PytestAssertRewriteWarning)

# Fixture pentru Pylenium
@pytest.fixture
def py():
    config = PyleniumConfig()
    py = Pylenium(config=config)
    yield py
    # Comentăm linia care închide browserul automat
    # py.quit()

# Test simplu folosind Pylenium
def test_example(py):
    py.visit('http://127.0.0.1:5000')
    py.get('h1').should().have_text('Add User') 

if __name__ == "__main__":
    pytest.main()

and I got this warnings:

python test_pyleniumio_001.py
===================================================================================== test session starts ======================================================================================
platform win32 -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
rootdir: C:\cypress\sqlite_python_server
plugins: allure-pytest-2.13.5, Faker-23.3.0, xdist-3.6.1
collected 1 item

test_pyleniumio_001.py
DevTools listening on ws://127.0.0.1:62394/devtools/browser/3a3eaa9f-3cbb-4ef8-88e5-e4d05cd53c8f
.                                                                                                                                                                  [100%]

======================================================================================= warnings summary ======================================================================================= 
..\..\Python312\Lib\site-packages\_pytest\config\__init__.py:1273
  C:\Python312\Lib\site-packages\_pytest\config\__init__.py:1273: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: faker
    self._mark_plugins_for_rewrite(hook)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================= 1 passed, 1 warning in 4.23s ================================================================================= 

Seam the:

warnings.filterwarnings("ignore", category=pytest.PytestAssertRewriteWarning)

not work and the browser is close even I comment the :

 # py.quit()

Why is need to rewrite: 'Module already imported so cannot be rewritten: faker' ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions