(self)
| 55 | |
| 56 | @pytest.fixture(scope="module", autouse=True) |
| 57 | def setup(self) -> Generator[None, None, None]: |
| 58 | # ---- Initialization |
| 59 | global CONFIG_FILE_PATH # noqa: PLW0603 |
| 60 | CONFIG_FILE_PATH = os.path.expanduser("~/.streamlit/config.toml") |
| 61 | |
| 62 | global CREDENTIALS_FILE_PATH # noqa: PLW0603 |
| 63 | CREDENTIALS_FILE_PATH = os.path.expanduser("~/.streamlit/credentials.toml") |
| 64 | |
| 65 | global REPO_ROOT # noqa: PLW0603 |
| 66 | REPO_ROOT = os.getcwd() |
| 67 | |
| 68 | global STREAMLIT_RELEASE_VERSION # noqa: PLW0603 |
| 69 | STREAMLIT_RELEASE_VERSION = os.environ.get("STREAMLIT_RELEASE_VERSION", None) |
| 70 | |
| 71 | # Ensure that there aren't any previously stored credentials |
| 72 | if os.path.exists(CREDENTIALS_FILE_PATH): |
| 73 | os.remove(CREDENTIALS_FILE_PATH) |
| 74 | |
| 75 | yield # Run tests |
| 76 | |
| 77 | # ---- Tear Down |
| 78 | # Remove testing credentials |
| 79 | if os.path.exists(CREDENTIALS_FILE_PATH): |
| 80 | os.remove(CREDENTIALS_FILE_PATH) |
| 81 | |
| 82 | if os.path.exists(CONFIG_FILE_PATH): |
| 83 | os.remove(CONFIG_FILE_PATH) |
| 84 | |
| 85 | self.run_command("streamlit cache clear") |
| 86 | |
| 87 | def parameterize(self, params: str) -> list[str]: |
| 88 | return params.split(" ") |
no test coverage detected