Returns a unique temporary directory for the test to use. If you call this method multiple times during in a test, it will return the same folder. However, across different runs the directories will be different. This will ensure that across different runs tests will not be
(self)
| 34 | self._tempdir = None |
| 35 | |
| 36 | def get_temp_dir(self): |
| 37 | """Returns a unique temporary directory for the test to use. |
| 38 | |
| 39 | If you call this method multiple times during in a test, it will return the |
| 40 | same folder. However, across different runs the directories will be |
| 41 | different. This will ensure that across different runs tests will not be |
| 42 | able to pollute each others environment. |
| 43 | If you need multiple unique directories within a single test, you should |
| 44 | use `self.create_tempdir()`, provided by `absltest.TestCase`. |
| 45 | tempfile.mkdtemp(dir=self.get_temp_dir()): |
| 46 | |
| 47 | Returns: |
| 48 | string, the path to the unique temporary directory created for this test. |
| 49 | """ |
| 50 | if not self._tempdir: |
| 51 | self._tempdir = self.create_tempdir().full_path |
| 52 | return self._tempdir |
| 53 | |
| 54 | |
| 55 | def main(*args, **kwargs): |
no outgoing calls
no test coverage detected