Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple cases, but same data dir #473

Open
gurhar1133 opened this issue Apr 26, 2024 · 3 comments
Open

Multiple cases, but same data dir #473

gurhar1133 opened this issue Apr 26, 2024 · 3 comments
Assignees

Comments

@gurhar1133
Copy link
Contributor

Sometimes there are multiple test cases that manipulate the same data in different ways. It is helpful to copy that same data_dir into separate subdirs in work_dir so that afterwards you can inspect the work_dir sub dirs to see what happened.

Example of what this could look like:

def test_ ... ():
    def _a(case_work_dir):
        ...

    def _bcase_work_dir):
        ...

    def _c(case_work_dir):
        ...

    pkunit.cases_from_same_data_dir(
        [
            _a,
            _b,
            _c,
        ]
    )
# in pkunit
def cases_from_same_data_dir(cases):
    w = pkunit.work_dir()
    for i in range(len(cases)):
        c = w.join(str(i + 1))
        shutil.copytree(pkunit.data_dir(), c)
        cases[i](c)

After the test runs I'll have a work_dir/1, work_dir/2, ..., work_dir/n to inspect. pkunit.case_dirs will call shutil.copytree on an existing work_subdir however which will run an error and not allow for the comparison of different cases effects on the data

Thoughts @robnagler ?

@gurhar1133 gurhar1133 self-assigned this Apr 26, 2024
@gurhar1133
Copy link
Contributor Author

ping @robnagler

@robnagler
Copy link
Member

Not a top priority, sorry.

@gurhar1133
Copy link
Contributor Author

Not a top priority, sorry.

NP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants