|
@ -44,10 +44,10 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
@contextlib.contextmanager |
|
|
@contextlib.contextmanager |
|
|
def chdir(): |
|
|
def chdir(*path): |
|
|
"""Context to temporarry change current directory to this file directory |
|
|
"""Context to temporarry change current directory, relative to this file directory |
|
|
""" |
|
|
""" |
|
|
with files.chdir(resource_filename(__name__, "")): |
|
|
with files.chdir(resource_filename(__name__, ""), *path): |
|
|
yield |
|
|
yield |
|
|
|
|
|
|
|
|
def assertRender(self, base, destformat): # pylint: disable=invalid-name |
|
|
def assertRender(self, base, destformat): # pylint: disable=invalid-name |
|
@ -91,7 +91,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): |
|
|
cls._create_test(base, dest), |
|
|
cls._create_test(base, dest), |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
with files.chdir('errors'): |
|
|
with cls.chdir('errors'): |
|
|
for source in sorted(glob.glob('*.source')): |
|
|
for source in sorted(glob.glob('*.source')): |
|
|
base = source[:-len(".source")] |
|
|
base = source[:-len(".source")] |
|
|
yield ( |
|
|
yield ( |
|
@ -117,8 +117,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): |
|
|
def test_parse_failure(self): |
|
|
def test_parse_failure(self): |
|
|
"""Test that `base` parsing fails.""" |
|
|
"""Test that `base` parsing fails.""" |
|
|
sourcename = "{}.source".format(base) |
|
|
sourcename = "{}.source".format(base) |
|
|
with self.chdir(): |
|
|
with self.chdir('errors'): |
|
|
with files.chdir('errors'): |
|
|
|
|
|
parser = self.song_plugins[LANGUAGES['sgc']]['sgc'] |
|
|
parser = self.song_plugins[LANGUAGES['sgc']]['sgc'] |
|
|
self.assertRaises(SyntaxError, parser, sourcename, self.config) |
|
|
self.assertRaises(SyntaxError, parser, sourcename, self.config) |
|
|
|
|
|
|
|
|