@@ -18,6 +18,7 @@ def test_go_to_google(py):
1818 assert 'Google' in py.title()
1919"""
2020
21+ import copy
2122import json
2223import logging
2324import os
@@ -109,9 +110,9 @@ def test_run(project_root, request) -> str:
109110 return test_results_dir
110111
111112
112- @pytest .fixture (scope = "function " )
113- def py_config (project_root , request ) -> PyleniumConfig :
114- """Initialize a PyleniumConfig for each test
113+ @pytest .fixture (scope = "session " )
114+ def _py_config (project_root , request ) -> PyleniumConfig :
115+ """Read the PyleniumConfig for the test session
115116
116117 1. This starts by deserializing the user-created pylenium.json from the Project Root.
117118 2. If that file is not found, then proceed with Pylenium Defaults.
@@ -169,6 +170,15 @@ def py_config(project_root, request) -> PyleniumConfig:
169170 return config
170171
171172
173+ @pytest .fixture (scope = "function" )
174+ def py_config (_py_config ) -> PyleniumConfig :
175+ """Get a fresh copy of the PyleniumConfig for each test
176+
177+ See _py_config for how the initial configuration is read.
178+ """
179+ return copy .deepcopy (_py_config )
180+
181+
172182@pytest .fixture (scope = "function" )
173183def test_case (test_run , py_config , request ) -> TestCase :
174184 """Manages data pertaining to the currently running Test Function or Case.
0 commit comments