added invalid tests
parent
3d528f85cb
commit
d019601298
@ -0,0 +1,6 @@
|
||||
# comment
|
||||
heavy:
|
||||
mouse2:
|
||||
snort: attack
|
||||
'e':
|
||||
giggle: attack
|
@ -0,0 +1,6 @@
|
||||
# comment
|
||||
heavy:
|
||||
mouse8:
|
||||
hold: attack
|
||||
blarg:
|
||||
toggle: attack
|
@ -1,15 +1,36 @@
|
||||
"""
|
||||
Tests that we can import and execute the most basic valid test file.
|
||||
Uses: tests/validYAML.yaml
|
||||
Uses: tests/basic_test.yaml
|
||||
tests/mega.yaml
|
||||
"""
|
||||
import pytest
|
||||
import tfscript.cli
|
||||
import os
|
||||
from cli_test_helpers import ArgvContext, shell
|
||||
|
||||
class TestValidYaml:
|
||||
|
||||
def test_parseValidFile(self, tmp_path):
|
||||
def test_parseValidFile(self, tmp_path, capsys):
|
||||
"""Parse the basic test file."""
|
||||
with capsys.disabled():
|
||||
print(os.linesep + "Basic test output in {}".format(str(tmp_path)))
|
||||
|
||||
with ArgvContext('tfscript', '--directory', str(tmp_path),
|
||||
'-d', 'tests/basic_test.yaml'):
|
||||
tfscript.cli.main()
|
||||
|
||||
def test_megabyteYamlFile(self, tmp_path, capsys):
|
||||
"""Parse the test file that produces multi-megabyte output."""
|
||||
with capsys.disabled():
|
||||
print(os.linesep + "Multi-megabyte test output in {}".format(str(tmp_path)))
|
||||
|
||||
with ArgvContext('tfscript', '--directory', str(tmp_path),
|
||||
'-d', 'tests/validYAML.yaml'):
|
||||
'-d', 'tests/basic_test.yaml'):
|
||||
tfscript.cli.main()
|
||||
|
||||
def test_invalidKeyBind(self):
|
||||
"""Test handling of invalid YAML exception. Doesn't capture output."""
|
||||
with ArgvContext('tfscript', 'tests/invalid_keybind.yaml'):
|
||||
with pytest.raises(SystemExit):
|
||||
tfscript.cli.main()
|
||||
pytest.fail("Should abort without positional filename argument")
|
||||
|
Loading…
Reference in New Issue