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

basic example warning and some questions #337

Open
catafest-work opened this issue Sep 6, 2024 · 0 comments
Open

basic example warning and some questions #337

catafest-work opened this issue Sep 6, 2024 · 0 comments

Comments

@catafest-work
Copy link

catafest-work commented Sep 6, 2024

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' ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant