[golemfactory/golem] Moving ls_r function (analogue of `ls -r`) to dirmanager (#3074)

Wiezzel requested changes on this pull request.

Please fix these linter errors.

> @@ -55,6 +56,12 @@ def find_task_script(task_dir, script_name):
logger.error(«Script file {} does not exist!».format(script_file))

+def list_dir_recursive(dir: str) -> Generator[str]:

`Generator` takes 3 params. The return type should be `Iterator[str]`.

> @@ -3,8 +3,9 @@
from unittest.mock import patch

from apps.dummy.dummyenvironment import DummyTaskEnvironment
-from apps.dummy.task.dummytaskstate import DummyTaskDefaults, DummyTaskOptions, DummyTaskDefinition, ls_R
+from apps.dummy.task.dummytaskstate import DummyTaskDefaults, DummyTaskOptions, DummyTaskDefinition

Line too long.

> + # Depending on os, we are testing symlinks or not
+ if is_osx() or is_linux():
+ os.symlink(os.path.join(self.tempdir, «f2»),
+ os.path.join(self.tempdir, «ee», «ff», «f4»))
+ dirs = list(list_dir_recursive(self.tempdir))
+ true_dirs = {os.path.join(*[self.tempdir, *x])
+ for x in [[«ee», «f1»],
+ [«f2»],
+ [«aa», «bb», «f3»],
+ [«ee», «ff», «f4»]]}
+ self.assertEqual(set(dirs), true_dirs)
+ else:
+ dirs = list(list_dir_recursive(self.tempdir))
+ true_dirs = {os.path.join(*[self.tempdir, *x])
+ for x in [[«ee», «f1»], [«f2»], [«aa», «bb», «f3»]]}
+ self.assertEqual(set(dirs), true_dirs)

No newline at the end of file.

Добавить комментарий