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_datadir2/latex/} %
{@TEST_FOLDER@/latex/} %
{@PACKAGE_FOLDER@/data/latex/} %
{@DATA_FOLDER@/latex/} %
}
\makeatother
@ -44,7 +44,7 @@ guitar,
{@TEST_FOLDER@/subdir_datadir/} %
{@TEST_FOLDER@/subdir_datadir2/} %
{@TEST_FOLDER@/} %
{@PACKAGE_FOLDER@/data/} %
{@DATA_FOLDER@/} %
}

18
test/test_compilation/test_compilation.py

@ -2,13 +2,14 @@
# pylint: disable=too-few-public-methods
from pkg_resources import resource_filename
import glob
import os
import subprocess
import unittest
from patacrep.encoding import open_read
from pkg_resources import resource_filename
import patacrep
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):
"""Replace the placeholder paths with the local paths"""
placeholder = "@TEST_FOLDER@"
localpath = os.path.dirname(__file__)
expected = expected.replace(placeholder, localpath)
expected = expected.replace(
"@TEST_FOLDER@",
os.path.dirname(__file__),
)
import patacrep
placeholder = "@PACKAGE_FOLDER@"
localpath = os.path.abspath(resource_filename(patacrep.__name__, ''))
expected = expected.replace(placeholder, localpath)
expected = expected.replace(
"@DATA_FOLDER@",
os.path.abspath(resource_filename(patacrep.__name__, 'data')),
)
return super().assertMultiLineEqual(result, expected, msg)

Loading…
Cancel
Save