def test_parse_windows(self): with tutils.chdir(tutils.test_data.dirname): assert script.parse_command("data\\addonscripts\\recorder.py") == ( "data\\addonscripts\\recorder.py", []) assert script.parse_command( "data\\addonscripts\\recorder.py 'foo \\ bar'") == ( "data\\addonscripts\\recorder.py", ['foo \\ bar'])
def test_no_script_file(self): with tutils.raises("not found"): script.parse_command("notfound") with tutils.tmpdir() as dir: with tutils.raises("not a file"): script.parse_command(dir)
def test_parse_windows(self): with tutils.chdir(tutils.test_data.dirname): assert script.parse_command( "data\\addonscripts\\recorder.py" ) == ("data\\addonscripts\\recorder.py", []) assert script.parse_command( "data\\addonscripts\\recorder.py 'foo \\ bar'" ) == ("data\\addonscripts\\recorder.py", ['foo \\ bar'])
def test_parse_args(self): with tutils.chdir(tutils.test_data.dirname): assert script.parse_command("data/addonscripts/recorder.py") == ( "data/addonscripts/recorder.py", []) assert script.parse_command("data/addonscripts/recorder.py foo bar" ) == ("data/addonscripts/recorder.py", ["foo", "bar"]) assert script.parse_command( "data/addonscripts/recorder.py 'foo bar'") == ( "data/addonscripts/recorder.py", ["foo bar"])
def test_empty_command(self): with tutils.raises(exceptions.AddonError): script.parse_command("") with tutils.raises(exceptions.AddonError): script.parse_command(" ")
def is_error(self, col, val): try: script.parse_command(val) except exceptions.AddonError as e: return str(e)
def test_parse_args(self): with tutils.chdir(tutils.test_data.dirname): assert script.parse_command("data/addonscripts/recorder.py") == ("data/addonscripts/recorder.py", []) assert script.parse_command("data/addonscripts/recorder.py foo bar") == ("data/addonscripts/recorder.py", ["foo", "bar"]) assert script.parse_command("data/addonscripts/recorder.py 'foo bar'") == ("data/addonscripts/recorder.py", ["foo bar"])