Merge pull request #174041 from dotlambda/sqlalchemy-utils-tests
python3Packages.sqlalchemy-utils: run tests
This commit is contained in:
commit
269dd4fd7e
|
@ -1,7 +1,19 @@
|
|||
{ lib, fetchPypi, buildPythonPackage
|
||||
, six, sqlalchemy
|
||||
, mock, pytz, isort, flake8, jinja2, pg8000, pyodbc, pytest, pymysql, python-dateutil
|
||||
, docutils, flexmock, psycopg2, pygments }:
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, six
|
||||
, sqlalchemy
|
||||
, colour
|
||||
, flexmock
|
||||
, jinja2
|
||||
, mock
|
||||
, pg8000
|
||||
, phonenumbers
|
||||
, pygments
|
||||
, pymysql
|
||||
, pytestCheckHook
|
||||
, python-dateutil
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "sqlalchemy-utils";
|
||||
|
@ -13,33 +25,32 @@ buildPythonPackage rec {
|
|||
sha256 = "9e01d6d3fb52d3926fcd4ea4a13f3540701b751aced0316bff78264402c2ceb4";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# We don't run MySQL, MSSQL, or PostgreSQL
|
||||
./skip-database-tests.patch
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
six
|
||||
sqlalchemy
|
||||
];
|
||||
|
||||
# Attempts to access localhost and there's also no database access
|
||||
doCheck = false;
|
||||
checkInputs = [
|
||||
mock
|
||||
pytz
|
||||
isort
|
||||
flake8
|
||||
jinja2
|
||||
pg8000
|
||||
pyodbc
|
||||
pytest
|
||||
pymysql
|
||||
python-dateutil
|
||||
docutils
|
||||
colour
|
||||
flexmock
|
||||
psycopg2
|
||||
jinja2
|
||||
mock
|
||||
pg8000
|
||||
phonenumbers
|
||||
pygments
|
||||
pymysql
|
||||
pytestCheckHook
|
||||
python-dateutil
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
pytest tests
|
||||
'';
|
||||
disabledTests = [
|
||||
"test_literal_bind"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/kvesteri/sqlalchemy-utils";
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
diff --git a/conftest.py b/conftest.py
|
||||
index 9e146cd..8dbc9a5 100644
|
||||
--- a/conftest.py
|
||||
+++ b/conftest.py
|
||||
@@ -61,16 +61,12 @@ def mysql_db_user():
|
||||
|
||||
@pytest.fixture
|
||||
def postgresql_dsn(postgresql_db_user, postgresql_db_password, db_name):
|
||||
- return 'postgresql://{0}:{1}@localhost/{2}'.format(
|
||||
- postgresql_db_user,
|
||||
- postgresql_db_password,
|
||||
- db_name
|
||||
- )
|
||||
+ pytest.skip()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mysql_dsn(mysql_db_user, db_name):
|
||||
- return 'mysql+pymysql://{0}@localhost/{1}'.format(mysql_db_user, db_name)
|
||||
+ pytest.skip()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -108,8 +104,7 @@ def mssql_db_driver():
|
||||
|
||||
@pytest.fixture
|
||||
def mssql_dsn(mssql_db_user, mssql_db_password, mssql_db_driver, db_name):
|
||||
- return 'mssql+pyodbc://{0}:{1}@localhost/{2}?driver={3}'\
|
||||
- .format(mssql_db_user, mssql_db_password, db_name, mssql_db_driver)
|
||||
+ pytest.skip()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
diff --git a/tests/functions/test_database.py b/tests/functions/test_database.py
|
||||
index 0ad6721..83f208d 100644
|
||||
--- a/tests/functions/test_database.py
|
||||
+++ b/tests/functions/test_database.py
|
||||
@@ -76,28 +76,6 @@ class TestDatabasePostgres(DatabaseTest):
|
||||
"TEMPLATE my_template") in str(excinfo.value)
|
||||
|
||||
|
||||
-class TestDatabasePostgresPg8000(DatabaseTest):
|
||||
-
|
||||
- @pytest.fixture
|
||||
- def dsn(self, postgresql_db_user, postgresql_db_password):
|
||||
- return 'postgresql+pg8000://{0}:{1}@localhost/{2}'.format(
|
||||
- postgresql_db_user,
|
||||
- postgresql_db_password,
|
||||
- 'db_to_test_create_and_drop_via_pg8000_driver'
|
||||
- )
|
||||
-
|
||||
-
|
||||
-class TestDatabasePostgresPsycoPG2CFFI(DatabaseTest):
|
||||
-
|
||||
- @pytest.fixture
|
||||
- def dsn(self, postgresql_db_user, postgresql_db_password):
|
||||
- return 'postgresql+psycopg2cffi://{0}:{1}@localhost/{2}'.format(
|
||||
- postgresql_db_user,
|
||||
- postgresql_db_password,
|
||||
- 'db_to_test_create_and_drop_via_psycopg2cffi_driver'
|
||||
- )
|
||||
-
|
||||
-
|
||||
@pytest.mark.usefixtures('postgresql_dsn')
|
||||
class TestDatabasePostgresWithQuotedName(DatabaseTest):
|
||||
|
||||
@@ -116,31 +94,6 @@ class TestDatabasePostgresWithQuotedName(DatabaseTest):
|
||||
'TEMPLATE "my-template"') in str(excinfo.value)
|
||||
|
||||
|
||||
-class TestDatabasePostgresCreateDatabaseCloseConnection(object):
|
||||
- def test_create_database_twice(
|
||||
- self,
|
||||
- postgresql_db_user,
|
||||
- postgresql_db_password
|
||||
- ):
|
||||
- dsn_list = [
|
||||
- 'postgresql://{0}:{1}@localhost/db_test_sqlalchemy-util-a'.format(
|
||||
- postgresql_db_user,
|
||||
- postgresql_db_password
|
||||
- ),
|
||||
- 'postgresql://{0}:{1}@localhost/db_test_sqlalchemy-util-b'.format(
|
||||
- postgresql_db_user,
|
||||
- postgresql_db_password
|
||||
- ),
|
||||
- ]
|
||||
- for dsn_item in dsn_list:
|
||||
- assert not database_exists(dsn_item)
|
||||
- create_database(dsn_item, template="template1")
|
||||
- assert database_exists(dsn_item)
|
||||
- for dsn_item in dsn_list:
|
||||
- drop_database(dsn_item)
|
||||
- assert not database_exists(dsn_item)
|
||||
-
|
||||
-
|
||||
@pytest.mark.usefixtures('mssql_dsn')
|
||||
class TestDatabaseMssql(DatabaseTest):
|
||||
|
Loading…
Reference in a new issue