Browse Source

[test] New placeholder test.

pull/120/head
Louis 9 years ago
parent
commit
ff24e14f5e
  1. 4
      test/test_compilation/subdir.tex.control
  2. 18
      test/test_compilation/test_compilation.py

4
test/test_compilation/subdir.tex.control

@ -16,7 +16,7 @@
{@TEST_FOLDER@/subdir_datadir/latex/} % {@TEST_FOLDER@/subdir_datadir/latex/} %
{@TEST_FOLDER@/subdir_datadir2/latex/} % {@TEST_FOLDER@/subdir_datadir2/latex/} %
{@TEST_FOLDER@/latex/} % {@TEST_FOLDER@/latex/} %
{@PACKAGE_FOLDER@/data/latex/} % {@DATA_FOLDER@/latex/} %
} }
\makeatother \makeatother
@ -44,7 +44,7 @@ guitar,
{@TEST_FOLDER@/subdir_datadir/} % {@TEST_FOLDER@/subdir_datadir/} %
{@TEST_FOLDER@/subdir_datadir2/} % {@TEST_FOLDER@/subdir_datadir2/} %
{@TEST_FOLDER@/} % {@TEST_FOLDER@/} %
{@PACKAGE_FOLDER@/data/} % {@DATA_FOLDER@/} %
} }

18
test/test_compilation/test_compilation.py

@ -2,13 +2,14 @@
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
from pkg_resources import resource_filename
import glob import glob
import os import os
import subprocess import subprocess
import unittest import unittest
from patacrep.encoding import open_read from patacrep.encoding import open_read
from pkg_resources import resource_filename import patacrep
from .. import dynamic # pylint: disable=unused-import from .. import dynamic # pylint: disable=unused-import
@ -93,13 +94,14 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
def assertMultiLineEqual(self, result, expected, msg=None): def assertMultiLineEqual(self, result, expected, msg=None):
"""Replace the placeholder paths with the local paths""" """Replace the placeholder paths with the local paths"""
placeholder = "@TEST_FOLDER@" expected = expected.replace(
localpath = os.path.dirname(__file__) "@TEST_FOLDER@",
expected = expected.replace(placeholder, localpath) os.path.dirname(__file__),
)
import patacrep expected = expected.replace(
placeholder = "@PACKAGE_FOLDER@" "@DATA_FOLDER@",
localpath = os.path.abspath(resource_filename(patacrep.__name__, '')) os.path.abspath(resource_filename(patacrep.__name__, 'data')),
expected = expected.replace(placeholder, localpath) )
return super().assertMultiLineEqual(result, expected, msg) return super().assertMultiLineEqual(result, expected, msg)

Loading…
Cancel
Save