Skip to content

Commit

Permalink
Merge pull request #16 from sot/fix-windows
Browse files Browse the repository at this point in the history
Fix / improve tests to run on Windows
  • Loading branch information
taldcroft authored Mar 4, 2020
2 parents 00df0d2 + 752e364 commit 6f6737a
Showing 1 changed file with 7 additions and 6 deletions.
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

0 comments on commit 6f6737a

Please sign in to comment.