123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import os
- from pathlib import Path
- from unittest.mock import patch
- import pandas as pd
- import pytest
- from flask import Flask, g
- csv = pd.read_csv(
- f"{Path(Path(__file__).parent.resolve())}{os.path.sep}current-covid-patients-hospital.csv", parse_dates=["Day"]
- )
- small_dataframe_data = {"name": ["A", "B", "C"], "value": [1, 2, 3]}
- @pytest.fixture(scope="function")
- def csvdata():
- yield csv
- @pytest.fixture(scope="function")
- def small_dataframe():
- yield small_dataframe_data
- @pytest.fixture(scope="function")
- def gui(helpers):
- from taipy.gui import Gui
- gui = Gui()
- yield gui
-
- gui.stop()
- helpers.test_cleanup()
- @pytest.fixture
- def helpers():
- from .helpers import Helpers
- return Helpers
- @pytest.fixture
- def test_client():
- flask_app = Flask("Test App")
-
- with flask_app.test_client() as testing_client:
-
- with flask_app.app_context():
- g.client_id = "test client id"
- yield testing_client
- @pytest.fixture(scope="function", autouse=True)
- def patch_cli_args():
- with patch("sys.argv", ["prog"]):
- yield
|