From 7f526efeed7b807a3b56f465637bee5dc8a27e3d Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 18 Apr 2024 22:28:55 +0200 Subject: have data_dir as a placeholder in testing.ini --- tests/bootstrap/test_new_instance.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tests/bootstrap') diff --git a/tests/bootstrap/test_new_instance.py b/tests/bootstrap/test_new_instance.py index e136579..dc3076e 100644 --- a/tests/bootstrap/test_new_instance.py +++ b/tests/bootstrap/test_new_instance.py @@ -39,6 +39,18 @@ def install_fietsboek(venv_path: Path) -> Path: return venv_path / "bin" +def create_config(config_name: Path): + """Copies the testing.ini config and fills in the placeholders. + + :param config_name: Path to the resulting config. + """ + shutil.copy(REPO_BASE / "testing.ini", config_name) + config = config_name.read_text() + config = config.replace("# %% fietsboek.data_dir %%", "fietsboek.data_dir = %(here)s/data") + config_name.write_text(config) + Path("data").mkdir() + + def test_setup_via_fietsupdate(tmpdir): with chdir(tmpdir): # We create a new temporary virtual environment with a fresh install, just @@ -47,8 +59,7 @@ def test_setup_via_fietsupdate(tmpdir): binaries_path = install_fietsboek(tmpdir / "venv") LOGGER.info("Creating a test configuration") - shutil.copy(REPO_BASE / "testing.ini", "testing.ini") - Path("data").mkdir() + create_config(Path("testing.ini")) # Try to run the migrations subprocess.check_call( -- cgit v1.2.3