Commit 52f1453b authored by cbergmiller's avatar cbergmiller Committed by GitHub

Merge pull request #65 from FreeOpcUa/fix_60_aiosqlite

Fix 60 aiosqlite
parents 4748b6bb f34d9155
......@@ -7,7 +7,7 @@ install:
- pip install pytz
- pip install lxml
- pip install aiofiles
- pip install asyncio-contextmanager
- pip install aiosqlite
- pip install pytest --upgrade
- pip install pytest-asyncio
- pip install cryptography
......
......@@ -13,11 +13,11 @@ class UaNodeAlreadyHistorizedError(ua.UaError):
class HistoryStorageInterface:
"""
Interface of a history backend.
Must be implemented by backends
"""
async def init(self):
"""
Async. initialization.
......@@ -185,7 +185,7 @@ class HistoryDict(HistoryStorageInterface):
class SubHandler:
def __init__(self, storage, loop):
self.storage = storage
self.loop = loop
self.loop = loop
def datachange_notification(self, node, val, data):
self.loop.create_task(
......@@ -274,7 +274,7 @@ class HistoryManager:
"""
if node in self._handlers:
await self._sub.unsubscribe(self._handlers[node])
del(self._handlers[node])
del (self._handlers[node])
else:
self.logger.error("History Manager isn't subscribed to %s", node)
......@@ -329,9 +329,9 @@ class HistoryManager:
starttime = ua.ua_binary.Primitives.DateTime.unpack(Buffer(rv.ContinuationPoint))
dv, cont = await self.storage.read_node_history(rv.NodeId,
starttime,
details.EndTime,
details.NumValuesPerNode)
starttime,
details.EndTime,
details.NumValuesPerNode)
if cont:
cont = ua.ua_binary.Primitives.DateTime.pack(cont)
# rv.IndexRange
......@@ -348,10 +348,10 @@ class HistoryManager:
starttime = ua.ua_binary.Primitives.DateTime.unpack(Buffer(rv.ContinuationPoint))
evts, cont = await self.storage.read_event_history(rv.NodeId,
starttime,
details.EndTime,
details.NumValuesPerNode,
details.Filter)
starttime,
details.EndTime,
details.NumValuesPerNode,
details.Filter)
results = []
for ev in evts:
field_list = ua.HistoryEventFieldList()
......
This diff is collapsed.
......@@ -36,7 +36,7 @@ class UTC(tzinfo):
return timedelta(0)
def datetime_to_win_epoch(dt):
def datetime_to_win_epoch(dt: datetime):
"""method copied from David Buxton <david@gasmark6.com> sample code"""
if (dt.tzinfo is None) or (dt.tzinfo.utcoffset(dt) is None):
dt = dt.replace(tzinfo=UTC())
......
......@@ -10,7 +10,7 @@ setup(
packages=find_packages(),
provides=["asyncua"],
license="GNU Lesser General Public License v3 or later",
install_requires=["aiofiles", "python-dateutil", "pytz", "lxml", 'cryptography'],
install_requires=["aiofiles", "aiosqlite", "python-dateutil", "pytz", "lxml", 'cryptography'],
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
......
......@@ -19,13 +19,9 @@ def pytest_generate_tests(metafunc):
if 'opc' in metafunc.fixturenames:
metafunc.parametrize('opc', ['client', 'server'], indirect=True)
elif 'history' in metafunc.fixturenames:
#metafunc.parametrize('history', ['dict', 'sqlite'], indirect=True)
#FIXME: disable sqlite backend, it breaks
metafunc.parametrize('history', ['dict'], indirect=True)
metafunc.parametrize('history', ['dict', 'sqlite'], indirect=True)
elif 'history_server' in metafunc.fixturenames:
#FIXME: disable sqlite backend, it breaks
#metafunc.parametrize('history_server', ['dict', 'sqlite'], indirect=True)
metafunc.parametrize('history_server', ['dict'], indirect=True)
metafunc.parametrize('history_server', ['dict', 'sqlite'], indirect=True)
@pytest.yield_fixture(scope='module')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment