Skip to content

Commit 4ee578d

Browse files
committed
polish smoke test
1 parent 843d83f commit 4ee578d

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ repos:
3737
files: \.py$
3838
verbose: true
3939
entry: env PYTHONPATH=bindings/python pylint
40-
args: [-d, "bad-continuation,global-statement,missing-docstring,missing-module-docstring,line-too-long,too-many-arguments,duplicate-code,redefined-outer-name,too-many-locals,bare-except,broad-except,import-outside-toplevel,protected-access"]
40+
args: [-d, "bad-continuation,global-statement,missing-docstring,missing-module-docstring,line-too-long,too-many-arguments,duplicate-code,redefined-outer-name,too-many-locals,bare-except,broad-except,import-outside-toplevel,protected-access,too-many-statements"]

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ add_subdirectory(loaders)
4949
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
5050
include(CTest)
5151
enable_testing()
52-
set(GENOMICSQLITE_TEST_ENV env PYTHONPATH=$PYTHONPATH:${CMAKE_CURRENT_SOURCE_DIR}/bindings/python LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${CMAKE_BINARY_DIR} GENOMICSQLITE_SYSTEM_LIBRARY=1)
52+
set(GENOMICSQLITE_TEST_ENV env PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/bindings/python:${PYTHONPATH} LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}:${LD_LIBRARY_PATH} GENOMICSQLITE_SYSTEM_LIBRARY=1)
5353
add_test(NAME smoketest COMMAND ${GENOMICSQLITE_TEST_ENV} python3 ${CMAKE_CURRENT_SOURCE_DIR}/test/genomicsqlite_smoke_test.py)
5454
add_test(NAME pytest COMMAND ${GENOMICSQLITE_TEST_ENV} python3 -m pytest -xv -n 4 --tb=short ${CMAKE_CURRENT_SOURCE_DIR}/test)
5555
endif()

bindings/python/genomicsqlite/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
_DLL = os.path.join(_HERE, "libgenomicsqlite.so")
2222
if not _DLL:
2323
_DLL = find_library("genomicsqlite")
24-
assert _DLL, "Unable to locate genomicsqlite shared-library file"
24+
assert _DLL, "Unable to locate a suitable genomicsqlite shared-library file"
2525
# open a dummy connection to :memory: just for loading the extension.
2626
_MEMCONN = sqlite3.connect(":memory:")
2727
_MEMCONN.enable_load_extension(True)

test/genomicsqlite_smoke_test.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ def main():
3838
print(next(conn.execute("SELECT sqlite_version()"))[0])
3939

4040
print("genomicsqlite: ", end="")
41-
import genomicsqlite
41+
try:
42+
import genomicsqlite
43+
except ImportError as exn:
44+
print(f"\n\nUnable to import genomicsqlite: {exn}")
45+
print("The Python genomicsqlite package may need to be installed via pip3 or conda,")
46+
print("or its location may need to be added to PYTHONPATH.")
47+
sys.exit(1)
4248

4349
print(genomicsqlite.__version__)
4450
print(f"genomicsqlite library: {genomicsqlite._DLL}")
@@ -103,7 +109,7 @@ def main():
103109
"** Please redirect this log to a file and send to maintainers @ https://github.com/mlin/GenomicSQLite\n"
104110
)
105111

106-
sys.exit(1)
112+
sys.exit(2)
107113

108114
dbconn.close()
109115
print("\n ✓ GenomicSQLite smoke test OK\n")
@@ -475,4 +481,4 @@ def main():
475481
except Exception:
476482
print()
477483
traceback.print_exc(file=sys.stdout)
478-
sys.exit(2)
484+
sys.exit(1)

0 commit comments

Comments
 (0)