|
1
|
|
|
import os |
|
|
|
|
|
|
2
|
|
|
import pytest |
|
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
# @pytest.fixture(scope='module') |
|
5
|
|
|
# def senario(): |
|
6
|
|
|
|
|
7
|
|
|
import subprocess |
|
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
# from click.testing import CliRunner |
|
10
|
|
|
|
|
11
|
|
|
this_dir = os.path.dirname(os.path.realpath(__file__)) |
|
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
def test_launching(tmpdir): |
|
|
|
|
|
|
14
|
|
|
target_directory = str(tmpdir.mkdir('unittest-datasets-dir')) |
|
15
|
|
|
os.environ["COLLECTIONS_DIR"] = target_directory |
|
16
|
|
|
ro = subprocess.run(['transform', 'posts', os.path.join(this_dir, 'test-pipeline.cfg'), '--sample 100', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
|
|
17
|
|
|
assert ro.returncode == 0 |
|
18
|
|
|
ro = subprocess.run(['train', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
|
|
19
|
|
|
assert ro.returncode == 0 |
|
20
|
|
|
ro = subprocess.run(['tune', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
|
|
21
|
|
|
assert ro.returncode == 0 |
|
22
|
|
|
ro = subprocess.run(['make-graphs', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
|
|
23
|
|
|
assert ro.returncode == 0 |
|
24
|
|
|
ro = subprocess.run(['report-datasets', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
|
|
25
|
|
|
assert ro.returncode == 0 |
|
26
|
|
|
ro = subprocess.run(['report-models', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
|
|
27
|
|
|
assert ro.returncode == 0 |
|
28
|
|
|
ro = subprocess.run(['report-topics', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
|
|
29
|
|
|
assert ro.returncode == 0 |
|
30
|
|
|
ro = subprocess.run(['report-kl', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
|
|
31
|
|
|
assert ro.returncode == 0 |
|
32
|
|
|
|
|
33
|
|
|
# def test_main(): |
|
34
|
|
|
# runner = CliRunner() |
|
35
|
|
|
# result = runner.invoke(main, ['--help']) |
|
36
|
|
|
# assert result.exit_code == 0 |
|
37
|
|
|
|
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.