<filename>tests/base/api/test_config.py
import pathlib
import sys

from app import Config
from tests.utils import BaseTestCase, TEST_DATA_DIR


class TestConfig(BaseTestCase):
    def test_parsing(self):
        old_argv = sys.argv
        sys.argv = ['script_path', '--config', str(TEST_DATA_DIR.joinpath('example_config.ini'))]
        parsed_config = Config.parse()
        sys.argv = old_argv

        self.assertEqual(parsed_config.bot_token, '<KEY>')
        self.assertEqual(parsed_config.admin_username, 'superman')
        self.assertEqual(parsed_config.storage_dir, str(pathlib.Path('surely/relative\path').resolve()))

<filename>tests/base/api/test_config.py
import pathlib
import sys

from app import Config
from tests.utils import BaseTestCase, TEST_DATA_DIR


class TestConfig(BaseTestCase):
    def test_parsing(self):
        old_argv = sys.argv
        sys.argv = ['script_path', '--config', str(TEST_DATA_DIR.joinpath('example_config.ini'))]
        parsed_config = Config.parse()
        sys.argv = old_argv

        self.assertEqual(parsed_config.bot_token, '<KEY>')
        self.assertEqual(parsed_config.admin_username, 'superman')
        self.assertEqual(parsed_config.storage_dir, str(pathlib.Path('surely/relative\path').resolve()))
