mirror of
https://github.com/loot/libloot-python.git
synced 2026-07-27 14:14:13 -07:00
Use CTest to run Python tests
Avoid having to copy the test script by modifying PYTHONPATH at runtime, and move the test script into the test directory.
This commit is contained in:
+5
-5
@@ -106,11 +106,11 @@ add_custom_command(TARGET loot_api POST_BUILD
|
||||
"${LIBLOOT_EXTRACTED_PATH}/${LIBLOOT_SHARED_LIBRARY}"
|
||||
"$<TARGET_FILE_DIR:loot_api>/${LIBLOOT_SHARED_LIBRARY}")
|
||||
|
||||
# Copy the test Python script to the build directory.
|
||||
add_custom_command(TARGET loot_api POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CMAKE_SOURCE_DIR}/src/test.py"
|
||||
"$<TARGET_FILE_DIR:loot_api>/test.py")
|
||||
enable_testing()
|
||||
|
||||
add_test(NAME python
|
||||
WORKING_DIRECTORY $<TARGET_FILE_DIR:loot_api>
|
||||
COMMAND "${PYTHON_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/test/test.py)
|
||||
|
||||
########################################
|
||||
# Install
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import cProfile
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.append(os.getcwd())
|
||||
|
||||
from loot_api import Version
|
||||
from loot_api import WrapperVersion
|
||||
from loot_api import GameType
|
||||
@@ -63,7 +68,7 @@ class TestLootApi(GameFixture):
|
||||
self.assertNotEqual(db, None)
|
||||
|
||||
class TestDatabaseInterface(GameFixture):
|
||||
masterlist_path = u'../../test/masterlist.yaml'
|
||||
masterlist_path = os.path.join(os.path.dirname(__file__), u'masterlist.yaml')
|
||||
|
||||
def setUp(self):
|
||||
super(TestDatabaseInterface, self).setUp()
|
||||
Reference in New Issue
Block a user