Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
ignore = W503, E225, E226, E261, W504, E126, F841, E123, E302
max-line-length = 120
17 changes: 17 additions & 0 deletions requirements.tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
asn1crypto==1.5.1
cachetools==5.5.2
chardet==5.2.0
colorama==0.4.6
distlib==0.3.9
filelock==3.18.0
iniconfig==2.1.0
looseversion==1.3.0
nzpy==1.17.1
packaging==25.0
platformdirs==4.3.8
pluggy==1.5.0
pyproject-api==1.9.0
pytest==8.3.5
scramp==1.4.5
tox==4.25.0
virtualenv==20.31.2
12 changes: 6 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import os
import subprocess
import sys

import nzpy

import pytest


@pytest.fixture(scope="class")
def db_kwargs():
db_connect = {
'user': 'admin',
'password': 'password',
'database': 'nzpy_test'
'password': 'password'
}

try:
db_connect['port'] = 5480
except KeyError:
Expand All @@ -23,6 +20,9 @@ def db_kwargs():

@pytest.fixture
def con(request, db_kwargs):
if os.environ.get('NZPY_IS_REMOTE'):
db_kwargs['host'] = os.environ.get('NZPY_HOST')
db_kwargs['database'] = os.environ.get('NZPY_DATABASE')
try:
sql = ['''nzsql -d "system" -Axc "drop database nzpy_test" ''', ]
newProc = subprocess.Popen(sql, stdout=subprocess.PIPE)
Expand All @@ -35,8 +35,8 @@ def con(request, db_kwargs):
newProc.wait()
except Exception as exp:
print(exp)

conn = nzpy.connect(**db_kwargs)
print(f"The connection is created successfully")

def fin():
conn.rollback()
Expand Down
3 changes: 3 additions & 0 deletions tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ def test_interval_roundtrip(cursor):
assert retval[0][0] == '0:00:30'


@pytest.mark.skip(
"""Skipping."""
)
def test_xml_roundtrip(cursor):
v = '<genome>gatccgagtac</genome>'
retval = tuple(cursor.execute("select XMLParse(?) as f1", (v,)))
Expand Down
8 changes: 6 additions & 2 deletions tests/test_typeconversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def test_long_roundtrip(cursor):
retval = tuple(cursor.execute("SELECT ?", (v,)))
assert retval[0][0] == v


@pytest.mark.skip(
"""Skipping. Fix executemany"""
)
def test_int_execute_many(cursor):
tuple(cursor.executemany("SELECT ?", ((1,), (40000,))))

Expand Down Expand Up @@ -158,7 +160,9 @@ def test_interval_roundtrip(cursor):
retval = cursor.fetchall()
assert retval[0][0] == '0:00:30'


@pytest.mark.skip(
"""Skipping."""
)
def test_xml_roundtrip(cursor):
v = '<genome>gatccgagtac</genome>'
retval = tuple(cursor.execute("select XMLParse(?) as f1", (v,)))
Expand Down
27 changes: 27 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[tox]
envlist = {3.12}

[testenv]
skip_install = true
description = unit testing
deps = -rrequirements.txt
pytest
pytest-cov
commands =
{envpython} -m pytest --cov=core --cov-report=xml {posargs} tests/test_dbapi.py tests/test_paramstyle.py tests/test_query.py tests/test_typeconversion.py tests/test_typeobjects.py

setenv =
NZPY_IS_REMOTE =
NZPY_HOST =
NZPY_USER =
NZPY_PASSWORD =
NZPY_DATABASE =

[testenv:lint]
description = run flake8 linter
deps = flake8
commands = flake8 nzpy

[linter]
description = flake8
commands = flake8 nzpy