1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-09-28 17:21:29 +00:00

fix cmake test

This commit is contained in:
Lu Wang 2013-09-16 11:33:08 +08:00
parent f3e1cd6937
commit d60eb58aad
3 changed files with 18 additions and 22 deletions

View File

@ -214,6 +214,5 @@ install (FILES ${datafiles} DESTINATION share/pdf2htmlEX)
install (FILES pdf2htmlEX.1 DESTINATION share/man/man1)
enable_testing()
add_test(NAME test_naming
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND python test/test_naming.py)
add_test(test_naming
python ${CMAKE_SOURCE_DIR}/test/test_naming.py)

10
debian/changelog vendored
View File

@ -1,14 +1,8 @@
pdf2htmlex (0.9-1~git201309161048rd4aa0-0ubuntu1) raring; urgency=low
pdf2htmlex (0.9-1~git201309161055rf3e1c-0ubuntu1) raring; urgency=low
* fix cmake test for packaging
-- WANG Lu <coolwanglu@gmail.com> Mon, 16 Sep 2013 10:48:02 +0800
pdf2htmlex (0.9-1~git201309161036rd4aa0-0ubuntu1) raring; urgency=low
* fix cmake test for packaging
-- WANG Lu <coolwanglu@gmail.com> Mon, 16 Sep 2013 10:36:46 +0800
-- WANG Lu <coolwanglu@gmail.com> Mon, 16 Sep 2013 10:55:04 +0800
pdf2htmlex (0.9-1~git201309161021rf2993-0ubuntu1) raring; urgency=low

View File

@ -7,14 +7,17 @@ import tempfile
import shutil
import subprocess
# The location where the executable is generated by the build
PDF2HTMLEX_PATH = '../pdf2htmlEX'
# The location where the base css file, etc is stored in the build folder
DATA_DIR = '../share'
# We assume that this file is put inside SRC_DIR/test
TEST_DIR = os.path.dirname(__file__)
# The location where our test PDFs are stored
TEST_DATA_DIR = './test_data'
TEST_DATA_DIR = os.path.join(TEST_DIR, 'test_data')
# The location where the base css file, etc is stored in the build folder
DATA_DIR = os.path.join(TEST_DIR, '../share')
# The script should be run in the directory containing the binary
# The location where the executable is generated by the build
PDF2HTMLEX_PATH = './pdf2htmlEX'
def execute_pdf2htmlex_with_args(args):
"""
@ -26,9 +29,9 @@ def execute_pdf2htmlex_with_args(args):
:rtype: int
:return: The exit code of the command
"""
executable = os.path.abspath(os.path.join(os.path.dirname(__file__), PDF2HTMLEX_PATH))
executable = os.path.abspath(PDF2HTMLEX_PATH)
cmd = [executable, '--data-dir', os.path.abspath(os.path.join(os.path.dirname(__file__), DATA_DIR))]
cmd = [executable, '--data-dir', os.path.abspath(DATA_DIR)]
for val in args:
cmd.append(str(val))
@ -74,7 +77,7 @@ def path_to_test_file(filename):
:rtype: str
:returns: the full path to the test file
"""
return os.path.abspath(os.path.join(os.path.dirname(__file__), TEST_DATA_DIR, filename))
return os.path.abspath(os.path.join(TEST_DATA_DIR, filename))
class OutputNamingTests(unittest.TestCase):
def test_generate_single_html_default_name_single_page_pdf(self):
@ -251,7 +254,7 @@ class OutputNamingTests(unittest.TestCase):
self.assertEquals(files, ['foo%%.html'])
if __name__=="__main__":
executable = os.path.abspath(os.path.join(os.path.dirname(__file__), PDF2HTMLEX_PATH))
executable = os.path.abspath(PDF2HTMLEX_PATH)
if not os.path.isfile(executable) or not os.access(executable, os.X_OK):
print >> sys.stderr, "Cannot locate pdf2htmlEX executable. Make sure source was built before running this test."
exit(1)