Skip to content

Commit

Permalink
Merge pull request #4144 from VesnaT/fix_mssql_test
Browse files Browse the repository at this point in the history
PymssqlBackend: Skip tests if pymssql not installed
  • Loading branch information
lanzagar authored Oct 25, 2019
2 parents 66c2911 + 1c109e3 commit 0ceeeb3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Orange/data/tests/test_sql_mssql.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import unittest

from Orange.data.sql.backend.base import BackendError
from Orange.data.sql.backend.mssql import PymssqlBackend, parse_ex
try:
from Orange.data.sql.backend.mssql import PymssqlBackend, parse_ex
err = ""
except ModuleNotFoundError as ex:
PymssqlBackend = None
err = str(ex)


class TestPymssqlBackend(unittest.TestCase):
@unittest.skipIf(PymssqlBackend is None, err)
def test_connection_error(self):
connection_params = {"host": "host", "port": "", "database": "DB"}
self.assertRaises(BackendError, PymssqlBackend, connection_params)

@unittest.skipIf(PymssqlBackend is None, err)
def test_parse_ex(self):
err_msg = "Foo"
self.assertEqual(parse_ex(ValueError(err_msg)), err_msg)
Expand Down

0 comments on commit 0ceeeb3

Please sign in to comment.