-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_preprocess_parallel.py
More file actions
33 lines (29 loc) · 1.22 KB
/
test_preprocess_parallel.py
File metadata and controls
33 lines (29 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
from click.testing import CliRunner
from batbot.batbot_cli import preprocess
def test_preprocess_parallel():
runner = CliRunner()
data = runner.invoke(
preprocess,
['examples', '-o', './output', '--process-metadata', '--force-overwrite', '-n', 2],
)
# parse stdout to ensure example files were processed properly
# limiting to 2 examples for now
num_examples = 2
output_str = str(data.output).split('\n')
for ii in range(num_examples):
expected_file = './output/example{}.01of01.compressed.jpg'.format(ii + 1)
assert any(
[expected_file in x for x in output_str]
), 'Did not find file listed among outputs: {}'.format(expected_file)
assert os.path.exists(expected_file), 'Did not find file in filesystem: {}'.format(
expected_file
)
for ii in range(num_examples):
expected_file = './output/example{}.metadata.json'.format(ii + 1)
assert any(
[expected_file in x for x in output_str]
), 'Did not find file listed among outputs: {}'.format(expected_file)
assert os.path.exists(expected_file), 'Did not find file in filesystem: {}'.format(
expected_file
)