Skip to content

Commit

Permalink
Put everything back
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Jan 7, 2025
1 parent 1cdd63a commit 5204a60
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 40 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/gramps-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:
jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
Expand All @@ -53,11 +53,9 @@ jobs:
sudo apt-get install python3-jsonschema
sudo apt-get install libxml2-utils
sudo apt-get install python3-lxml
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
sudo apt-get install python-libxml2
sudo apt-get install zlib1g-dev
sudo apt-get install python3-setuptools
sudo apt-get install python3-pytest
- name: Install addons
run: |
mkdir -p ~/.gramps/gramps52/plugins/
Expand All @@ -67,9 +65,6 @@ jobs:
tar -C ~/.gramps/gramps52/plugins -xzf ExportRaw.addon.tgz
- name: Build
run: |
python3 --version
python3 -c "import sqlite3; print(sqlite3.version)"
sqlite3 --version
python3 setup.py build
- name: Run unit test suite
run: |
Expand Down
29 changes: 0 additions & 29 deletions gramps/gen/filters/rules/test/person_select_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,13 @@
import unittest
import os
import sqlite3
import pytest

from ....db.utils import import_as_dict
from ....const import DATA_DIR
from ....user import User
from gramps.gen.db import DbGeneric


# Does this version of sqlite support json functions?

conn = sqlite3.connect(":memory:")

cursor = conn.cursor()
try:
cursor.execute("SELECT json_object('key1', 'value1')")
JSON_SUPPORT = True
except sqlite3.OperationalError:
JSON_SUPPORT = False

cursor = conn.cursor()
try:
cursor = conn.cursor()
cursor.execute('SELECT json_array_length(\'["a", "b", "c"]\')')
result = cursor.fetchone()[0]
JSON_ARRAY_LENGTH_SUPPORT = True
except sqlite3.OperationalError:
JSON_ARRAY_LENGTH_SUPPORT = False

conn.close()

TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")

Expand Down Expand Up @@ -148,7 +125,6 @@ def setUpClass(cls):
"""
cls.db = import_as_dict(EXAMPLE, User())

@pytest.mark.skipif(not JSON_ARRAY_LENGTH_SUPPORT)
def test_order_by_1(self):
res = list(
self.db.select_from_person(
Expand All @@ -168,7 +144,6 @@ def test_order_by_1(self):
["Garner", 1],
]

@pytest.mark.skipif(not JSON_ARRAY_LENGTH_SUPPORT)
def test_order_by_2(self):
res = list(
self.db.select_from_person(
Expand Down Expand Up @@ -230,7 +205,6 @@ def test_order_by_2_generic(self):
["Martel", 0],
]

@pytest.mark.skipif(not JSON_ARRAY_LENGTH_SUPPORT)
def test_HavePhotos(self):
res = list(
self.db.select_from_person("_.handle", where="len(person.media_list) > 0")
Expand All @@ -245,7 +219,6 @@ def test_HavePhotos_generic(self):
)
self.assertEqual(len(res), 5)

@pytest.mark.skipif(not JSON_ARRAY_LENGTH_SUPPORT)
def test_HasLDS(self):
res = list(
self.db.select_from_person(
Expand Down Expand Up @@ -303,7 +276,6 @@ def test_HasLDS_generic(self):
# res = self.filter_with_rule(rule)
# self.assertEqual(len(res), 3)

@pytest.mark.skipif(not JSON_ARRAY_LENGTH_SUPPORT)
def test_disconnected(self):
res = set(
list(
Expand Down Expand Up @@ -348,7 +320,6 @@ def test_everyone_generic(self):
res = list(DbGeneric._select_from_table(self.db, "person"))
self.assertEqual(len(res), self.db.get_number_of_people())

@pytest.mark.skipif(not JSON_ARRAY_LENGTH_SUPPORT)
def test_hasalternatename(self):
"""
Test HasAlternateName rule.
Expand Down
5 changes: 1 addition & 4 deletions gramps/plugins/db/dbapi/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ def execute(self, *args, **kwargs):
:type kwargs: list
"""
self.log.debug(args)
try:
self.__cursor.execute(*args, **kwargs)
except Exception:
raise Exception("args: %r, kwargs: %r" % (args, kwargs)) from None
self.__cursor.execute(*args, **kwargs)

def fetchone(self):
"""
Expand Down

0 comments on commit 5204a60

Please sign in to comment.