Skip to content

Commit

Permalink
[CI] Fix tests of CI
Browse files Browse the repository at this point in the history
  • Loading branch information
klieret committed Apr 19, 2019
1 parent ae9d9ac commit ac202a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
14 changes: 9 additions & 5 deletions randomfiletree/cli.py
Expand Up @@ -16,26 +16,30 @@ def parser():
"--directory-probability",
default=1,
dest="prob_folder",
help="Probability to create a folder"
help="Probability to create a folder",
type=float
)
parser.add_argument(
"-f",
"--file-probability",
default=1,
dest="prob_file",
help="Probability to create a file"
help="Probability to create a file",
type=float
)
parser.add_argument(
"-r",
"--repeat",
default=10,
default=2,
help="Number of times to traverse existing file/directory structure to "
"create new elements"
"create new elements",
type=int
)
parser.add_argument(
"--maxdepth",
default=None,
help="Maximal depth of file/directory structure to create"
help="Maximal depth of file/directory structure to create",
type=int
)
return parser

Expand Down
1 change: 1 addition & 0 deletions randomfiletree/core.py
Expand Up @@ -45,6 +45,7 @@ def create_random_tree(basedir, prob_file=2, prob_folder=1, repeat=1,
allfiles = []
for i in range(repeat):
for root, dirs, files in os.walk(str(basedir)):
print(root)
if random.random() < prob_folder:
p = Path(root) / random_string()
p.mkdir(exist_ok=True)
Expand Down
6 changes: 3 additions & 3 deletions randomfiletree/test/test_cli.py
Expand Up @@ -20,6 +20,6 @@ def test_cli_module(self):
def test_parser(self):
p = parser()
with tempfile.TemporaryDirectory() as dirname:
cli(p.parse_args(dirname))
cli(p.parse_args(dirname, "-f", 0.5, "-d", 3, "-r", 10))
cli(p.parse_args(dirname, "-f", 0.5, "-d", 3, "--maxdepth", 5))
cli(p.parse_args([dirname]))
cli(p.parse_args([dirname, "-f", "0.5", "-d", "3", "-r", "3"]))
cli(p.parse_args([dirname, "-f", "0.5", "-d", "3", "--maxdepth", "2"]))

0 comments on commit ac202a4

Please sign in to comment.