Hello,

I saw a number of requests about setUpClass/tearDownClass. We don't
actually support them in Avocado, as already stated in our docs, but
most of the requests are actually interested in have a temporary
directory that can be the same throughout the job, so every test can
use that directory to share information that is common to all the
tests.

One way to provide that would be exposing the Job temporary directory,
but providing a supported API where a test can actually write to
another test results can break our promise that tests are independent
from each other.

Another way that comes to my mind is to use the pre/post plugin to
handle that. On `pre`, we can create a temporary directory and set an
environment variable with the path for it. On `post` we remove that
directory. Something like:

```
class TestsTmpdir(JobPre, JobPost):
    ...

    def pre(self, job):
        os.environ['AVOCADO_TESTS_TMPDIR'] = tempfile.mkdtemp(prefix='avocado_')

    def post(self, job):
        if os.environ.get('AVOCADO_TESTS_TMPDIR') is not None:
            shutil.rmtree(os.environ.get('AVOCADO_TESTS_TMPDIR'))
```

Thoughts?

Reply via email to