Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix / improve tests to run on Windows #16

Merged
merged 1 commit into from
Mar 4, 2020
Merged
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
13 changes: 7 additions & 6 deletions Ska/DBI/tests/test_dbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pytest
import numpy as np
import tempfile

from Ska.DBI import DBI


Expand All @@ -27,6 +28,9 @@

class DBI_BaseTests(object):
def setup_class(cls):
if cls.db_config['dbi'] == 'sqlite':
cls.tmpdir = tempfile.TemporaryDirectory()
cls.db_config['server'] = os.path.join(cls.tmpdir.name, 'sqlite3.db3')
cls.db = DBI(**cls.db_config)

def teardown_class(cls):
Expand All @@ -39,6 +43,7 @@ def teardown_class(cls):
cls.db.cursor.close()
cls.db.conn.close()


def test_05_force_drop_table(self):
try:
self.db.execute('drop table ska_dbi_test_table')
Expand Down Expand Up @@ -92,15 +97,11 @@ def test_55_drop_table(self):


class TestSqliteWithNumpy(DBI_BaseTests):
fh, fn = tempfile.mkstemp(suffix='.db3')
db_config = dict(dbi='sqlite', server=fn, numpy=True)
os.unlink(fn)
db_config = dict(dbi='sqlite', numpy=True)


class TestSqliteWithoutNumpy(DBI_BaseTests):
fh, fn = tempfile.mkstemp(suffix='.db3')
db_config = dict(dbi='sqlite', server=fn, numpy=False)
os.unlink(fn)
db_config = dict(dbi='sqlite', numpy=False)


@pytest.mark.skipif('not HAS_SYBASE', reason='No SYBASE_OCS and/or sybpydb.so')
Expand Down