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

Creating unique temporary directories on DUT #3

Open
kjeldflarup opened this issue May 28, 2018 · 0 comments
Open

Creating unique temporary directories on DUT #3

kjeldflarup opened this issue May 28, 2018 · 0 comments

Comments

@kjeldflarup
Copy link

We would like to make a generic mechanism in labgrid, which can be used for creating a mktemp(1) directory on target and copy files to that.

def test_hello(request,target):
   command = target.get_active_driver( "CommandProtocol")
   tmpdir = command.mkdtemp()
   tmpdir.put(os.path.join(request.fspath, 'src/hello'))
   stdout = command.run_check(tmpdir.path + '/' + 'hello')

mkdtemp() execute mktemp -d on DUT, and returns an object with a put method, which sets the destination directory to the temporary directory.

Now should this feature be added to CommandProtocol or FileTransferProtocol?
The driver needed to do this, must have both!

The Class for the returned object, should of course also be in the labgrid three.
labgrid/util seems to be the most appropriate place.

The returned object is quite limited. It would have been great with at clone of pytest's tmpdir with py.path.local support. But as far as I can see, none of the code can be reused. Thus all needs to be rewritten from scratch.

Implementing this as a function scope fixture would also make sense, but there is no obvious place to put new generic fixtures in the labgrid tree.

@Emantor Emantor transferred this issue from labgrid-project/labgrid May 24, 2019
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

1 participant