A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import pytest
|
|
|
|
from scripttease.library.overlays.posix import touch, Function
|
|
|
|
from scripttease.library.scripts import Script
|
|
|
|
# from scripttease.parsers import filter_commands, load_commands
|
|
|
|
from scripttease.parsers.base import Parser
|
|
|
|
|
|
|
|
|
|
|
|
class TestParser(object):
|
|
|
|
|
|
|
|
def test_as_script(self):
|
|
|
|
p = Parser("/path/to/nonexistent.txt")
|
|
|
|
assert isinstance(p.as_script(), Script)
|
|
|
|
|
|
|
|
# def test_get_commands(self):
|
|
|
|
# pass
|
|
|
|
#
|
|
|
|
def test_get_functions(self):
|
|
|
|
parser = Parser("/it/does/not/matter.ini")
|
|
|
|
|
|
|
|
command = touch("/path/to/file.txt", function="testing")
|
|
|
|
function = Function("testing")
|
|
|
|
parser._commands.append(command)
|
|
|
|
parser._functions.append(function)
|
|
|
|
|
|
|
|
assert len(parser.get_functions()) == 1
|
|
|
|
|
|
|
|
def test_load(self):
|
|
|
|
p = Parser("/path/to/nonexistent.txt")
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
|
|
p.load()
|