-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
The tmp_path fixture has scope "function". Hence your copie fixture will always have the same scope which makes it less useful than it could be.
I have worked first on a fixture for creating a temp_path (for dst) that has a larger scope, e.g
@pytest.fixture(scope="session")
def copier_dst(tmp_path_factory):
target = tmp_path_factory.mktemp("copier")
LOGGER.info(target)
return targetand then doing the expensive construction of the template only once for all tests...
@pytest.fixture(scope="module")
def result(src_path, copier_dst):
run_copy(
src_path=src_path,
dst_path=copier_dst,
unsafe=True,
defaults=True,
user_defaults={"project_name": "maffay"},
)
os.chdir(copier_dst)
# fire off poetry
os.system("poetry update -vv")
# yield the folder
yield copier_dst
# the path is deleted at the very end when all tests have finished
shutil.rmtree(copier_dst)I am now exposing the built template and can run various tests against it.
What do you think? Please share your thoughts.
Metadata
Metadata
Assignees
Labels
No labels