def test_load_config_local():
"""
Test `load_config()` with local configuration file.
"""
with TemporaryDirectory() as tmpdir:
tmpdir = Path(tmpdir)
# Change home directory for testing
os.environ['MARKDOWNREVEAL_HOME'] = str(tmpdir)
# Create local configuration file
config_file = tmpdir / 'config.yaml'
config_file.write_text('footer: "local footer"\n'
'header: "local header"\n'
'style: "https://other/style/file.tar.gz"')
# Load configuration
old = Path.cwd()
os.chdir(str(tmpdir))
config = load_config()
os.chdir(str(old))
assert config['local_path'] == tmpdir / '.markdownreveal'
assert config['output_path'] == config['local_path'] / 'out'
assert config['footer'] == 'local footer'
assert config['header'] == 'local header'
assert 'other/style' in config['style']
评论列表
文章目录