conftest.py 516 B

1234567891011121314151617181920212223
  1. import shutil
  2. import tempfile
  3. import pytest
  4. from gpustack.config.config import Config, set_global_config
  5. @pytest.fixture(scope="module", autouse=True)
  6. def temp_dir():
  7. tmp_dir = tempfile.mkdtemp()
  8. print(f"Created temporary directory: {tmp_dir}")
  9. yield tmp_dir
  10. shutil.rmtree(tmp_dir)
  11. @pytest.fixture(scope="module", autouse=True)
  12. def config(temp_dir):
  13. cfg = Config(
  14. token="test",
  15. jwt_secret_key="test",
  16. data_dir=temp_dir,
  17. )
  18. set_global_config(cfg)
  19. return cfg