Merge pull request #31 from vmapetr/v-mapetr/build-with-loadable-sqlite-extensions

Build Python3 for nix and darwin with enabled loadable sqlite extensions
This commit is contained in:
Alena Sviridenko
2020-06-09 15:14:26 +03:00
committed by GitHub
4 changed files with 51 additions and 5 deletions

View File

@@ -41,6 +41,12 @@ Describe "Tests" {
"python ./sources/simple-test.py" | Should -ReturnZeroExitCode
}
if ($Version -ge "3.2.0") {
It "Check if sqlite3 module is installed" {
"python ./sources/python-sqlite3.py" | Should -ReturnZeroExitCode
}
}
if (IsNixPlatform $Platform) {
It "Check for failed modules in build_output" {

View File

@@ -0,0 +1,19 @@
import sqlite3
from sqlite3 import Error
def create_connection(db_file):
""" create a database connection to a SQLite database """
conn = None
try:
print('Sqlite3 version: ', sqlite3.version)
conn = sqlite3.connect(db_file)
conn.enable_load_extension(True)
except Error as e:
print(e)
exit(1)
finally:
if conn:
conn.close()
if __name__ == '__main__':
create_connection(r"pythonsqlite.db")