| """Override ShellStep to set cwd and env.""" |
| |
| from __future__ import absolute_import |
| from slave.step import shell_step |
| |
| |
| class UnitTestShellStep(shell_step.ShellStep): |
| """Unit test steps which include cwd and env.""" |
| |
| def __init__(self, env=None, **kwargs): |
| """Constructor.""" |
| shell_step.ShellStep.__init__(self, **kwargs) |
| self._env = env |
| |
| def get_commands(self): |
| """Returns which commands to be run. Can be overridden by a subclass. |
| |
| Returns: |
| List of ShellCommand objects to execute. |
| """ |
| assert isinstance(self._command, list) |
| return [self.ShellCommand(self._command, |
| cwd=self.directory, |
| env=self._env)] |