1{ lib, stdenv, buildPythonPackage, fetchPypi, fetchpatch, python
2, unittest2, scripttest, pytz, mock
3, testtools, pbr, tempita, decorator, sqlalchemy
4, six, sqlparse, testrepository
5}:
6buildPythonPackage rec {
7 pname = "sqlalchemy-migrate";
8 version = "0.13.0";
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "1y0lcqii7b4vp7yh9dyxrl4i77hi8jkkw7d06mgdw2h458ljxh0b";
13 };
14
15 # See: https://review.openstack.org/#/c/608382/
16 patches = [ (fetchpatch {
17 url = "https://github.com/openstack/sqlalchemy-migrate/pull/18.patch";
18 sha256 = "1qyfq2m7w7xqf0r9bc2x42qcra4r9k9l9g1jy5j0fvlb6bvvjj07";
19 }) ];
20
21 checkInputs = [ unittest2 scripttest pytz mock testtools testrepository ];
22 propagatedBuildInputs = [ pbr tempita decorator sqlalchemy six sqlparse ];
23
24 doCheck = !stdenv.isDarwin;
25
26 prePatch = ''
27 sed -i -e /tempest-lib/d \
28 -e /testtools/d \
29 test-requirements.txt
30 '';
31 checkPhase = ''
32 export PATH=$PATH:$out/bin
33 echo sqlite:///__tmp__ > test_db.cfg
34 # depends on ibm_db_sa
35 rm migrate/tests/changeset/databases/test_ibmdb2.py
36 # wants very old testtools
37 rm migrate/tests/versioning/test_schema.py
38 # transient failures on py27
39 substituteInPlace migrate/tests/versioning/test_util.py --replace "test_load_model" "noop"
40 ${python.interpreter} setup.py test
41 '';
42
43 meta = with lib; {
44 homepage = "https://github.com/openstack/sqlalchemy-migrate";
45 description = "Schema migration tools for SQLAlchemy";
46 license = licenses.asl20;
47 maintainers = with maintainers; [ makefu ];
48 };
49}