-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Parametrize question: how to make 1 selenium-webdriver session per 1 test_*() function call irregardless of the number of parametrized sets of data? #2627
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
Comments
currently that is not supported, #2522 would enable it with a new scope |
Thank you. |
@inl-pd-autotest has this advanced or is still an issue? |
@nicoddemus Well, I got no answer, so it is still an issue. |
@inl-pd-autotest you could fake it by having a fixture that hold a browser and a key and at the lowert level request the browser with the "key" and drop it every time the key doesnt match |
I just noticed that ticket #2522 referenced in the first comment to this ticket has now been resolved. |
@inl-pd-autotest unfortunately its only half-fixed - we need a major release to fix the rest as far as i can tell (its not availiable as scope or in the node tree, so it cant help you with fixtures |
@RonnyPfannschmidt not sure I understand: is it already fixed, but just not in a release yet, or is it only half-fixed and there are still things to fix first before a new release with a new scope could come out? |
its the later and actually good call out - i need to make an issue |
I have conftest.py with a class that starts a selenium webdriver function.
I have test_something.py module with test_a() and test_b() functions.
Each of the functions is parametrized (uses @pytest.mark.parametrize fixture), so that each of them runs twice with different sets of parameters.
Problem: I need to make 1 webdriver session match 2 parametrized calls for each test function separately. In other words: webdriver_session1: test_a(param1), test_a(param2); webdriver_session2: test_b(param1), test_b(param2).
If I create an instance of the class outside the test functions - then I get 1 webdriver session per MODULE (1 session per 2 functions, instead of 1 session per 1 function).
If I create an instance of the class inside the test functions - then I get 1 webdriver sessions per PARAMETRIZED CALL (2 sessions per 1 function, instead of 1 session per 1 function).
I thought that wrapping test functions into test_wrapper_a() and test_wrapper_b() would help, but this way parametrizing doesn't work.
pip list:
CentOS 7x64.
conftest.py:
test_module_fail_1.py:
test_module_fail_2.py:
The text was updated successfully, but these errors were encountered: