Coverage for test/test_cli.py: 100%

1"""Test the CLI"""

2

3 import os

4 import filecmp

5 import pdb

6

7 import pytest

8

9@pytest.fixture(scope='session', autouse=True)

10 def clear_out_directory():

11 """Delete all files in test/out"""

12 folder = os.path.dirname(os.path.realpath(__file__)) + '/out'

13 for filename in os.listdir(folder):

14 if not filename == '.gitignore':

15 file_path = os.path.join(folder, filename)

16 os.unlink(file_path)

17 yield

18

19 def test_cli():

20 exit_status = os.system('python -m manyworlds --help')

21 assert exit_status == 0

22

23 def test_cli_hierarchy_output():

24 os.system('python -m manyworlds --input test/fixtures/scenarios_forest.feature --output test/out/scenarios_flat_strict_cli.feature > test/out/scenarios_hierarchy.txt')

25 assert filecmp.cmp('test/out/scenarios_hierarchy.txt',

26 'test/fixtures/scenarios_hierarchy.txt')