conftest.py 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. # Copyright 2021-2025 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. import pytest
  12. @pytest.fixture(scope="session")
  13. def browser_context_args(browser_context_args, e2e_port, e2e_base_url):
  14. return {
  15. **browser_context_args,
  16. "base_url": f"http://127.0.0.1:{e2e_port}{e2e_base_url}",
  17. "timezone_id": "Europe/Paris",
  18. }
  19. @pytest.fixture(scope="function")
  20. def gui(helpers, e2e_base_url):
  21. from taipy.gui import Gui
  22. gui = Gui()
  23. gui.load_config({"base_url": e2e_base_url, "host": "0.0.0.0" if e2e_base_url != "/" else "127.0.0.1"})
  24. yield gui
  25. # Delete Gui instance and state of some classes after each test
  26. gui.stop()
  27. helpers.test_cleanup()