autotako

Service to monitor moombox for completed livestream downloads to upload for distribution
git clone https://code.alwayswait.ing/autotako
Log | Files | Refs | README

conftest.py (814B)


      1 #!/usr/bin/python3
      2 
      3 import pathlib
      4 
      5 import msgspec
      6 import pytest
      7 from autotako.config import WebDavConfig
      8 
      9 
     10 class WebDavTestConfig(msgspec.Struct):
     11     webdav: WebDavConfig
     12     path: str = "test/upload.bin"
     13     """ Path to upload a test file to, including filename. """
     14 
     15 
     16 class Config(msgspec.Struct):
     17     test_webdav: WebDavTestConfig
     18 
     19 
     20 def pytest_addoption(parser):
     21     parser.addoption(
     22         "--test-config",
     23         action="store",
     24         type=pathlib.Path,
     25         default="test_config.toml",
     26         help="Path to test configuration file",
     27     )
     28 
     29 
     30 @pytest.fixture
     31 def config(request, scope="session"):
     32     return msgspec.toml.decode(
     33         request.config.getoption("--test-config").read_text(),
     34         type=Config,
     35     )
     36 
     37 
     38 @pytest.fixture
     39 def webdav_test_config(config):
     40     return config.test_webdav