diff options
Diffstat (limited to 'pkgs/development/python-modules')
17 files changed, 776 insertions, 53 deletions
diff --git a/pkgs/development/python-modules/cffi/default.nix b/pkgs/development/python-modules/cffi/default.nix index 5b0265601a3e..cced78c0c6a5 100644 --- a/pkgs/development/python-modules/cffi/default.nix +++ b/pkgs/development/python-modules/cffi/default.nix @@ -10,6 +10,8 @@ if isPyPy then null else buildPythonPackage rec { sha256 = "1mffyilq4qycm8gs4wkgb18rnqil8a9blqq77chdlshzxc8jkc5k"; }; + outputs = [ "out" "dev" ]; + propagatedBuildInputs = [ libffi pycparser ]; buildInputs = [ pytest ]; diff --git a/pkgs/development/python-modules/channels/default.nix b/pkgs/development/python-modules/channels/default.nix index 4dfe83f6758b..e5c92ffcde26 100644 --- a/pkgs/development/python-modules/channels/default.nix +++ b/pkgs/development/python-modules/channels/default.nix @@ -1,14 +1,14 @@ -{ stdenv, buildPythonPackage, fetchurl, +{ stdenv, buildPythonPackage, fetchPypi, asgiref, django, daphne }: buildPythonPackage rec { pname = "channels"; name = "${pname}-${version}"; - version = "1.1.6"; + version = "1.1.8"; - src = fetchurl { - url = "mirror://pypi/c/channels/${name}.tar.gz"; - sha256 = "44ab9a1f610ecc9ac25d5f90e7a44f49b18de28a05a26fe34e935af257f1eefe"; + src = fetchPypi { + inherit pname version; + sha256 = "0gsy3hwn1vd709jkw8ay44qrm6aw7qggr312z8xwzq0x4ihjda02"; }; # Files are missing in the distribution diff --git a/pkgs/development/python-modules/hupper/default.nix b/pkgs/development/python-modules/hupper/default.nix new file mode 100644 index 000000000000..3a8426e201f8 --- /dev/null +++ b/pkgs/development/python-modules/hupper/default.nix @@ -0,0 +1,20 @@ +{ buildPythonPackage, fetchPypi, python +, pytest, pytestcov, watchdog, mock +}: + +buildPythonPackage rec { + pname = "hupper"; + version = "1.0"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "02lj6kgaf9xpr0binxwac3gpdhljglyj9fr78s165jc7qd7mifdg"; + }; + + checkPhase = '' + py.test + ''; + + checkInputs = [ pytest pytestcov watchdog mock ]; +} diff --git a/pkgs/development/python-modules/keystoneauth1/default.nix b/pkgs/development/python-modules/keystoneauth1/default.nix index 17792723e4a3..7405f7f74cd5 100644 --- a/pkgs/development/python-modules/keystoneauth1/default.nix +++ b/pkgs/development/python-modules/keystoneauth1/default.nix @@ -2,24 +2,34 @@ , pbr, testtools, testresources, testrepository, mock , pep8, fixtures, mox3, requests-mock , iso8601, requests, six, stevedore, webob, oslo-config +, pyyaml, betamax, oauthlib }: buildPythonPackage rec { pname = "keystoneauth1"; - version = "3.1.0"; + version = "3.2.0"; name = "${pname}-${version}"; disabled = isPyPy; # a test fails src = fetchPypi { inherit pname version; - sha256 = "e5abfa8bbe866d52ca56afbe528d15214a60033cc1dc9804478cae7424f0f8fb"; + sha256 = "0rg3harfyvai34lrjiqnl1crmvswjvj8nsviasnz4b9pcvp3d03n"; }; - buildInputs = [ pbr testtools testresources testrepository mock - pep8 fixtures mox3 requests-mock ]; - propagatedBuildInputs = [ iso8601 requests six stevedore - webob oslo-config ]; + buildInputs = [ pbr ]; + checkInputs = [ pyyaml betamax oauthlib testtools testresources + testrepository mock pep8 fixtures mox3 requests-mock ]; + propagatedBuildInputs = [ iso8601 requests six stevedore webob ]; + doCheck = true; + # 1. oslo-config + # 2. oslo-utils + # 3. requests-kerberos + preCheck = '' + rm keystoneauth1/tests/unit/loading/test_{session,conf,adapter}.py + rm keystoneauth1/tests/unit/access/test_v{2,3}_access.py + rm keystoneauth1/tests/unit/extras/kerberos/test_fedkerb_loading.py + ''; postPatch = '' sed -i 's@python@${python.interpreter}@' .testr.conf substituteInPlace requirements.txt --replace "argparse" "" diff --git a/pkgs/development/python-modules/oslo-config/default.nix b/pkgs/development/python-modules/oslo-config/default.nix index 51b2f0df75dc..fce8c21284c7 100644 --- a/pkgs/development/python-modules/oslo-config/default.nix +++ b/pkgs/development/python-modules/oslo-config/default.nix @@ -1,16 +1,17 @@ -{ buildPythonPackage, fetchPypi, pbr, six, netaddr, stevedore, mock }: +{ lib, buildPythonPackage, fetchPypi, pbr, six, netaddr, stevedore, mock, +debtcollector, rfc3986, pyyaml, oslo-i18n }: buildPythonPackage rec { pname = "oslo.config"; - version = "4.11.0"; + version = "4.12.0"; name = "${pname}-${version}"; src = fetchPypi { inherit pname version; - sha256 = "1be8aaba466a3449fdb21ee8f7025b0d3d252c8c7568b8d5d05ceff58617cd05"; + sha256 = "1pa9lajsadyq47bmxx12dxlcmnqsqlgnb55hwqas26lgnb2073dx"; }; - propagatedBuildInputs = [ pbr six netaddr stevedore ]; + propagatedBuildInputs = [ pbr six netaddr stevedore debtcollector rfc3986 pyyaml oslo-i18n ]; buildInputs = [ mock ]; # TODO: circular import on oslo-i18n @@ -20,6 +21,12 @@ buildPythonPackage rec { substituteInPlace requirements.txt --replace "argparse" "" ''; - # Requires a bunch of new packages - meta.broken = true; + meta = with lib; { + description = "Oslo Configuration API"; + homepage = "https://docs.openstack.org/oslo.config/latest/"; + license = licenses.asl20; + maintainers = with maintainers; [ makefu ]; + }; + + } diff --git a/pkgs/development/python-modules/plaster-pastedeploy/default.nix b/pkgs/development/python-modules/plaster-pastedeploy/default.nix new file mode 100644 index 000000000000..330ecfc7c672 --- /dev/null +++ b/pkgs/development/python-modules/plaster-pastedeploy/default.nix @@ -0,0 +1,22 @@ +{ buildPythonPackage, fetchPypi, python +, plaster, PasteDeploy +, pytest, pytestcov +}: + +buildPythonPackage rec { + pname = "plaster_pastedeploy"; + version = "0.4.1"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "1lrbkya5birfmg9gnfcnsa9id28klmjcqbm33rcg69pv9sfld4jv"; + }; + + checkPhase = '' + py.test + ''; + + propagatedBuildInputs = [ plaster PasteDeploy ]; + checkInputs = [ pytest pytestcov ]; +} diff --git a/pkgs/development/python-modules/plaster/default.nix b/pkgs/development/python-modules/plaster/default.nix new file mode 100644 index 000000000000..9f370a9c0fb3 --- /dev/null +++ b/pkgs/development/python-modules/plaster/default.nix @@ -0,0 +1,20 @@ +{ buildPythonPackage, fetchPypi, python +, pytest, pytestcov +}: + +buildPythonPackage rec { + pname = "plaster"; + version = "0.5"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "0z48pis4qyhyqj3ia82r04diaa153dw66wrpbly06hdzvhw8j0ia"; + }; + + checkPhase = '' + py.test + ''; + + checkInputs = [ pytest pytestcov ]; +} diff --git a/pkgs/development/python-modules/pywbem/default.nix b/pkgs/development/python-modules/pywbem/default.nix index b728d4f6b943..8e10fbb22581 100644 --- a/pkgs/development/python-modules/pywbem/default.nix +++ b/pkgs/development/python-modules/pywbem/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, fetchFromGitHub, libxml2 +{ stdenv, buildPythonPackage, fetchFromGitHub, fetchpatch, libxml2 , m2crypto, ply, pyyaml, six , httpretty, lxml, mock, pytest, requests }: @@ -14,6 +14,12 @@ buildPythonPackage rec { sha256 = "0jcwklip03xcni0dvsk9va8ilqz21g4fxwqd5kzvv91slaadfcym"; }; + patches = [ + # fix timezone handling so the tests pass again. Can go when 0.10.1 is released + # https://github.com/pywbem/pywbem/issues/755#issuecomment-327508681 + ./make_cimdatetime_timezone_aware.patch + ]; + propagatedBuildInputs = [ m2crypto ply pyyaml six ]; checkInputs = [ httpretty lxml mock pytest requests ]; diff --git a/pkgs/development/python-modules/pywbem/make_cimdatetime_timezone_aware.patch b/pkgs/development/python-modules/pywbem/make_cimdatetime_timezone_aware.patch new file mode 100644 index 000000000000..55fb9bbb12d7 --- /dev/null +++ b/pkgs/development/python-modules/pywbem/make_cimdatetime_timezone_aware.patch @@ -0,0 +1,491 @@ +From bb7fa19d636d999bf844d80939e155b8f212ef3e Mon Sep 17 00:00:00 2001 +From: Andreas Maier <maiera@de.ibm.com> +Date: Fri, 23 Jun 2017 19:13:51 +0200 +Subject: [PATCH] Made CIMDateTime always timezone-aware, re-enabled + test_cim_types.py + +Details: +- Ensured that 'CIMDateTime' objects for point in time values are + timezone-aware when supplied with a timezone-naive 'datetime' + object. This does not change the behavior, but increases code + clarity. +- Clarified that in the documentation of 'CIMDateTime'. +- Added testcases for CIMDateTime. +- Re-enabled the testing of test_cim_types.py. Since its change + to using pytest it was not run because the test methods were + all static methods which apparently does not work. Not sure + this ever worked. + +Signed-off-by: Andreas Maier <maiera@de.ibm.com> +--- + docs/changes.rst | 5 + + pywbem/cim_types.py | 22 +-- + testsuite/test_cim_types.py | 369 +++++++++++++++++++++++--------------------- + 3 files changed, 207 insertions(+), 189 deletions(-) + +diff --git a/docs/changes.rst b/docs/changes.rst +index 272ed30d..6fdfbcf4 100644 +--- a/docs/changes.rst ++++ b/docs/changes.rst +@@ -72,6 +72,11 @@ Enhancements + + * Added unit test for recorder. See issue #676 + ++* Ensured that `CIMDateTime` objects for point in time values are ++ timezone-aware when supplied with a timezone-naive `datetime` object. ++ This does not change the behavior, but increases code clarity. ++ Clarified that in the documentation of `CIMDateTime`. See issue #698. ++ + Bug fixes + ^^^^^^^^^ + +diff --git a/pywbem/cim_types.py b/pywbem/cim_types.py +index 6d1f140c..5ecc7707 100644 +--- a/pywbem/cim_types.py ++++ b/pywbem/cim_types.py +@@ -74,6 +74,7 @@ + import re + import warnings + import six ++import copy + + from . import config + +@@ -294,9 +295,11 @@ def __init__(self, dtarg): + * A :term:`string` object will be + interpreted as CIM datetime format (see :term:`DSP0004`) and + will result in a point in time or a time interval. +- * A :class:`py:datetime.datetime` object must be timezone-aware +- (see :class:`~pywbem.MinutesFromUTC`) and will result in a point +- in time. ++ * A :class:`py:datetime.datetime` object will result in a point ++ in time. If the :class:`py:datetime.datetime` object is ++ timezone-aware (see :class:`~pywbem.MinutesFromUTC`), the ++ specified timezone will be used. Otherwise, a default timezone ++ of UTC will be assumed. + * A :class:`py:datetime.timedelta` object will result in a time + interval. + * Another :class:`~pywbem.CIMDateTime` object will be copied. +@@ -342,14 +345,15 @@ def __init__(self, dtarg): + raise ValueError('dtarg argument "%s" has an invalid CIM ' + 'datetime format' % dtarg) + elif isinstance(dtarg, datetime): +- self.__datetime = dtarg ++ if dtarg.tzinfo is None: ++ self.__datetime = dtarg.replace(tzinfo=MinutesFromUTC(0)) ++ else: ++ self.__datetime = copy.copy(dtarg) + elif isinstance(dtarg, timedelta): +- self.__timedelta = dtarg ++ self.__timedelta = copy.copy(dtarg) + elif isinstance(dtarg, CIMDateTime): +- # pylint: disable=protected-access +- self.__datetime = dtarg.__datetime +- # pylint: disable=protected-access +- self.__timedelta = dtarg.__timedelta ++ self.__datetime = copy.copy(dtarg.datetime) ++ self.__timedelta = copy.copy(dtarg.timedelta) + else: + raise TypeError('dtarg argument "%s" has an invalid type: %s ' + '(expected datetime, timedelta, string, or ' +diff --git a/testsuite/test_cim_types.py b/testsuite/test_cim_types.py +index 4ae354d3..b1f54d06 100755 +--- a/testsuite/test_cim_types.py ++++ b/testsuite/test_cim_types.py +@@ -43,105 +43,99 @@ def integer_tuple(request): + return request.param + + +-class TestIntegers: +- """ +- Test CIM integer data type classes. +- """ +- +- @staticmethod +- def test_class_attrs_class(integer_tuple): +- """Test class attrs via class level""" +- obj_type, exp_cimtype, exp_minvalue, exp_maxvalue = integer_tuple +- assert obj_type.cimtype == exp_cimtype +- assert obj_type.minvalue == exp_minvalue +- assert obj_type.maxvalue == exp_maxvalue +- +- @staticmethod +- def test_class_attrs_inst(integer_tuple): +- """Test class attrs via instance level""" +- obj_type, exp_cimtype, exp_minvalue, exp_maxvalue = integer_tuple +- obj = obj_type(42) +- assert obj.cimtype == exp_cimtype +- assert obj.minvalue == exp_minvalue +- assert obj.maxvalue == exp_maxvalue +- +- @staticmethod +- def test_inheritance(integer_tuple): +- """Test inheritance""" +- obj_type = integer_tuple[0] +- obj = obj_type(42) +- assert isinstance(obj, obj_type) +- assert isinstance(obj, CIMType) +- assert isinstance(obj, CIMInt) +- assert not isinstance(obj, CIMFloat) +- +- @staticmethod +- def test_init_int(integer_tuple): +- """Test initialization from integer value""" +- obj_type = integer_tuple[0] +- obj = obj_type(42) +- assert obj == 42 +- +- @staticmethod +- def test_init_str(integer_tuple): +- """Test initialization from string value""" +- obj_type = integer_tuple[0] +- obj = obj_type('42') +- assert obj == 42 +- +- @staticmethod +- def test_init_str_base10(integer_tuple): +- """Test initialization from string value with base 10""" +- obj_type = integer_tuple[0] +- obj = obj_type('42', 10) +- assert obj == 42 +- +- @staticmethod +- def test_init_str_base16(integer_tuple): +- """Test initialization from string value with base 16""" +- obj_type = integer_tuple[0] +- obj = obj_type('2A', 16) +- assert obj == 42 +- +- @staticmethod +- def test_init_minimum(integer_tuple): +- """Test initialization from integer value at minimum""" +- obj_type = integer_tuple[0] +- exp_minvalue = integer_tuple[2] +- obj = obj_type(exp_minvalue) +- assert obj == exp_minvalue +- +- @staticmethod +- def test_init_maximum(integer_tuple): +- """Test initialization from integer value at maximum""" +- obj_type = integer_tuple[0] +- exp_maxvalue = integer_tuple[3] +- obj = obj_type(exp_maxvalue) +- assert obj == exp_maxvalue +- +- @staticmethod +- def test_init_too_low(integer_tuple): +- """Test initialization from integer value below minimum""" +- obj_type = integer_tuple[0] +- exp_minvalue = integer_tuple[2] +- try: +- obj_type(exp_minvalue - 1) +- except ValueError: +- pass +- else: +- raise AssertionError("ValueError was not raised.") +- +- @staticmethod +- def test_init_too_high(integer_tuple): +- """Test initialization from integer value above maximum""" +- obj_type = integer_tuple[0] +- exp_maxvalue = integer_tuple[3] +- try: +- obj_type(exp_maxvalue + 1) +- except ValueError: +- pass +- else: +- raise AssertionError("ValueError was not raised.") ++def test_integer_class_attrs_class(integer_tuple): ++ """Test class attrs via class level""" ++ obj_type, exp_cimtype, exp_minvalue, exp_maxvalue = integer_tuple ++ assert obj_type.cimtype == exp_cimtype ++ assert obj_type.minvalue == exp_minvalue ++ assert obj_type.maxvalue == exp_maxvalue ++ ++ ++def test_integer_class_attrs_inst(integer_tuple): ++ """Test class attrs via instance level""" ++ obj_type, exp_cimtype, exp_minvalue, exp_maxvalue = integer_tuple ++ obj = obj_type(42) ++ assert obj.cimtype == exp_cimtype ++ assert obj.minvalue == exp_minvalue ++ assert obj.maxvalue == exp_maxvalue ++ ++ ++def test_integer_inheritance(integer_tuple): ++ """Test inheritance""" ++ obj_type = integer_tuple[0] ++ obj = obj_type(42) ++ assert isinstance(obj, obj_type) ++ assert isinstance(obj, CIMType) ++ assert isinstance(obj, CIMInt) ++ assert not isinstance(obj, CIMFloat) ++ ++ ++def test_integer_init_int(integer_tuple): ++ """Test initialization from integer value""" ++ obj_type = integer_tuple[0] ++ obj = obj_type(42) ++ assert obj == 42 ++ ++ ++def test_integer_init_str(integer_tuple): ++ """Test initialization from string value""" ++ obj_type = integer_tuple[0] ++ obj = obj_type('42') ++ assert obj == 42 ++ ++ ++def test_integer_init_str_base10(integer_tuple): ++ """Test initialization from string value with base 10""" ++ obj_type = integer_tuple[0] ++ obj = obj_type('42', 10) ++ assert obj == 42 ++ ++ ++def test_integer_init_str_base16(integer_tuple): ++ """Test initialization from string value with base 16""" ++ obj_type = integer_tuple[0] ++ obj = obj_type('2A', 16) ++ assert obj == 42 ++ ++ ++def test_integer_init_minimum(integer_tuple): ++ """Test initialization from integer value at minimum""" ++ obj_type = integer_tuple[0] ++ exp_minvalue = integer_tuple[2] ++ obj = obj_type(exp_minvalue) ++ assert obj == exp_minvalue ++ ++ ++def test_integer_init_maximum(integer_tuple): ++ """Test initialization from integer value at maximum""" ++ obj_type = integer_tuple[0] ++ exp_maxvalue = integer_tuple[3] ++ obj = obj_type(exp_maxvalue) ++ assert obj == exp_maxvalue ++ ++ ++def test_integer_init_too_low(integer_tuple): ++ """Test initialization from integer value below minimum""" ++ obj_type = integer_tuple[0] ++ exp_minvalue = integer_tuple[2] ++ try: ++ obj_type(exp_minvalue - 1) ++ except ValueError: ++ pass ++ else: ++ raise AssertionError("ValueError was not raised.") ++ ++ ++def test_integer_init_too_high(integer_tuple): ++ """Test initialization from integer value above maximum""" ++ obj_type = integer_tuple[0] ++ exp_maxvalue = integer_tuple[3] ++ try: ++ obj_type(exp_maxvalue + 1) ++ except ValueError: ++ pass ++ else: ++ raise AssertionError("ValueError was not raised.") + + + # +@@ -164,47 +158,41 @@ def real_tuple(request): + return request.param + + +-class TestReals: +- """ +- Test CIM real data type classes. +- """ +- +- @staticmethod +- def test_class_attrs_class(real_tuple): +- """Test class attrs via class level""" +- obj_type, exp_cimtype = real_tuple +- assert obj_type.cimtype == exp_cimtype +- +- @staticmethod +- def test_class_attrs_inst(real_tuple): +- """Test class attrs via instance level""" +- obj_type, exp_cimtype = real_tuple +- obj = obj_type(42) +- assert obj.cimtype == exp_cimtype +- +- @staticmethod +- def test_inheritance(real_tuple): +- """Test inheritance""" +- obj_type = real_tuple[0] +- obj = obj_type(42) +- assert isinstance(obj, obj_type) +- assert isinstance(obj, CIMType) +- assert isinstance(obj, CIMFloat) +- assert not isinstance(obj, CIMInt) +- +- @staticmethod +- def test_init_float(real_tuple): +- """Test initialization from floating point value""" +- obj_type = real_tuple[0] +- obj = obj_type(42.0) +- assert obj == 42.0 +- +- @staticmethod +- def test_init_str(real_tuple): +- """Test initialization from string value""" +- obj_type = real_tuple[0] +- obj = obj_type('42.0') +- assert obj == 42.0 ++def test_real_class_attrs_class(real_tuple): ++ """Test class attrs via class level""" ++ obj_type, exp_cimtype = real_tuple ++ assert obj_type.cimtype == exp_cimtype ++ ++ ++def test_real_class_attrs_inst(real_tuple): ++ """Test class attrs via instance level""" ++ obj_type, exp_cimtype = real_tuple ++ obj = obj_type(42) ++ assert obj.cimtype == exp_cimtype ++ ++ ++def test_real_inheritance(real_tuple): ++ """Test inheritance""" ++ obj_type = real_tuple[0] ++ obj = obj_type(42) ++ assert isinstance(obj, obj_type) ++ assert isinstance(obj, CIMType) ++ assert isinstance(obj, CIMFloat) ++ assert not isinstance(obj, CIMInt) ++ ++ ++def test_real_init_float(real_tuple): ++ """Test initialization from floating point value""" ++ obj_type = real_tuple[0] ++ obj = obj_type(42.0) ++ assert obj == 42.0 ++ ++ ++def test_real_init_str(real_tuple): ++ """Test initialization from string value""" ++ obj_type = real_tuple[0] ++ obj = obj_type('42.0') ++ assert obj == 42.0 + + + # +@@ -271,6 +259,26 @@ def test_init_str(real_tuple): + '20140924193040.654321+120' + ), + ( ++ datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40, ++ microsecond=654321, tzinfo=MinutesFromUTC(0)), ++ 'timestamp', ++ datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40, ++ microsecond=654321, tzinfo=MinutesFromUTC(0)), ++ None, ++ 0, ++ '20140924193040.654321+000' ++ ), ++ ( ++ datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40, ++ microsecond=654321), ++ 'timestamp', ++ datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40, ++ microsecond=654321, tzinfo=MinutesFromUTC(0)), ++ None, ++ 0, ++ '20140924193040.654321+000' ++ ), ++ ( + '20140924193040.654321+120', + 'timestamp', + datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40, +@@ -325,46 +333,47 @@ def datetime_init_tuple(request): + return request.param + + +-class TestDatetime: +- """ +- Test CIM real data type classes. +- """ +- +- @staticmethod +- def test_class_attrs_class(): +- """Test class attrs via class level""" +- assert CIMDateTime.cimtype == 'datetime' +- +- @staticmethod +- def test_class_attrs_inst(): +- """Test class attrs via instance level""" +- obj = CIMDateTime('00000000000000.000000:000') +- assert obj.cimtype == 'datetime' +- +- @staticmethod +- def test_inheritance(): +- """Test inheritance""" +- obj = CIMDateTime('00000000000000.000000:000') +- assert isinstance(obj, CIMDateTime) +- assert isinstance(obj, CIMType) +- assert not isinstance(obj, CIMFloat) +- assert not isinstance(obj, CIMInt) +- +- @staticmethod +- def test_init(datetime_init_tuple): +- """Test initialization from all input types""" +- (dtarg, exp_kind, exp_datetime, exp_timedelta, exp_minutesfromutc, +- exp_str) = datetime_init_tuple +- try: +- obj = CIMDateTime(dtarg) +- except Exception as exc: +- assert isinstance(exc, exp_kind) +- else: +- assert obj.is_interval == (exp_kind == 'interval') +- assert obj.datetime == exp_datetime +- assert obj.timedelta == exp_timedelta +- assert obj.minutes_from_utc == exp_minutesfromutc +- assert str(obj) == exp_str ++def test_datetime_class_attrs_class(): ++ """Test class attrs via class level""" ++ assert CIMDateTime.cimtype == 'datetime' ++ ++ ++def test_datetime_class_attrs_inst(): ++ """Test class attrs via instance level""" ++ obj = CIMDateTime('00000000000000.000000:000') ++ assert obj.cimtype == 'datetime' ++ ++ ++def test_datetime_inheritance(): ++ """Test inheritance""" ++ obj = CIMDateTime('00000000000000.000000:000') ++ assert isinstance(obj, CIMDateTime) ++ assert isinstance(obj, CIMType) ++ assert not isinstance(obj, CIMFloat) ++ assert not isinstance(obj, CIMInt) ++ ++ ++def test_datetime_init(datetime_init_tuple): ++ """Test initialization from all input types""" ++ (dtarg, exp_kind, exp_datetime, exp_timedelta, exp_minutesfromutc, ++ exp_str) = datetime_init_tuple ++ try: ++ obj = CIMDateTime(dtarg) ++ except Exception as exc: ++ assert isinstance(exc, exp_kind) ++ else: ++ assert obj.is_interval == (exp_kind == 'interval') ++ assert obj.datetime == exp_datetime ++ if obj.datetime is not None: ++ assert isinstance(obj.datetime, datetime) ++ # We ensure that the datetime is always timezone-aware: ++ assert obj.datetime.tzinfo is not None ++ assert obj.timedelta == exp_timedelta ++ if obj.timedelta is not None: ++ assert isinstance(obj.timedelta, timedelta) ++ assert obj.minutes_from_utc == exp_minutesfromutc ++ assert str(obj) == exp_str ++ + + # TODO: Add testcases for get_local_utcoffset() + # TODO: Add testcases for now() diff --git a/pkgs/development/python-modules/requests/default.nix b/pkgs/development/python-modules/requests/default.nix index b85bb54a4f15..f3ff4a84f1e8 100644 --- a/pkgs/development/python-modules/requests/default.nix +++ b/pkgs/development/python-modules/requests/default.nix @@ -12,6 +12,8 @@ buildPythonPackage rec { sha256 = "0zi3v9nsmv9j27d0c0m1dvqyvaxz53g8m0aa1h3qanxs4irkwi4w"; }; + outputs = [ "out" "dev" ]; + nativeBuildInputs = [ pytest ]; propagatedBuildInputs = [ urllib3 idna chardet certifi ]; # sadly, tests require networking diff --git a/pkgs/development/python-modules/requestsexceptions/default.nix b/pkgs/development/python-modules/requestsexceptions/default.nix new file mode 100644 index 000000000000..35d723836c95 --- /dev/null +++ b/pkgs/development/python-modules/requestsexceptions/default.nix @@ -0,0 +1,27 @@ +{ lib, buildPythonPackage, fetchPypi, pbr }: + +buildPythonPackage rec { + pname = "requestsexceptions"; + version = "1.3.0"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "0gim00vi7vfq16y8b9m1vpy01grqvrdrbh88jb98qx6n6sk1n54g"; + }; + + propagatedBuildInputs = [ pbr ]; + + # upstream hacking package is not required for functional testing + patchPhase = '' + sed -i '/^hacking/d' test-requirements.txt + ''; + + meta = with lib; { + description = "Import exceptions from potentially bundled packages in requests."; + homepage = "https://pypi.python.org/pypi/requestsexceptions"; + license = licenses.asl20; + maintainers = with maintainers; [ makefu ]; + patforms = platforms.all; + }; +} diff --git a/pkgs/development/python-modules/simanneal/default.nix b/pkgs/development/python-modules/simanneal/default.nix new file mode 100644 index 000000000000..e3f65b6660c2 --- /dev/null +++ b/pkgs/development/python-modules/simanneal/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchFromGitHub, buildPythonPackage, pytest }: + +buildPythonPackage rec { + pname = "simanneal"; + version = "0.4.1"; + name = "${pname}-${version}"; + + src = fetchFromGitHub { + owner = "perrygeo"; + repo = "simanneal"; + rev = version; + sha256 = "12499wvf7ii7cy8z2f1d472p7q9napg1lj0h9xx8l1mbr1hjlp3q"; + }; + + checkInputs = [ pytest ]; + checkPhase = "pytest tests"; + + meta = with stdenv.lib; { + description = "A python implementation of the simulated annealing optimization technique"; + homepage = https://github.com/perrygeo/simanneal; + license = licenses.isc; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/development/python-modules/sqlalchemy-migrate/default.nix b/pkgs/development/python-modules/sqlalchemy-migrate/default.nix index 9b431f29acb8..258f84e8c72a 100644 --- a/pkgs/development/python-modules/sqlalchemy-migrate/default.nix +++ b/pkgs/development/python-modules/sqlalchemy-migrate/default.nix @@ -12,7 +12,7 @@ buildPythonPackage rec { sha256 = "0ld2bihp9kmf57ykgzrfgxs4j9kxlw79sgdj9sfn47snw3izb2p6"; }; - checkInputs = [ unittest2 scripttest pytz pylint mock testtools ]; + checkInputs = [ unittest2 scripttest pytz pylint mock testtools tempest-lib ]; propagatedBuildInputs = [ pbr tempita decorator sqlalchemy six sqlparse ]; checkPhase = '' @@ -27,12 +27,12 @@ buildPythonPackage rec { ${python.interpreter} setup.py test ''; - # Tests require tempest-lib which requires the broken oslo-config - doCheck = false; + doCheck = true; meta = with stdenv.lib; { homepage = http://code.google.com/p/sqlalchemy-migrate/; description = "Schema migration tools for SQLAlchemy"; license = licenses.asl20; + maintainers = with maintainers; [ makefu ]; }; } diff --git a/pkgs/development/python-modules/subprocess32/default.nix b/pkgs/development/python-modules/subprocess32/default.nix new file mode 100644 index 000000000000..cb7a6fe2e868 --- /dev/null +++ b/pkgs/development/python-modules/subprocess32/default.nix @@ -0,0 +1,38 @@ +{ lib +, buildPythonPackage +, fetchPypi +, isPy3k +, isPyPy +, bash +, python +}: + +buildPythonPackage rec { + pname = "subprocess32"; + version = "3.2.7"; + name = "${pname}-${version}"; + disabled = isPy3k; + + src = fetchPypi { + inherit pname version; + sha256 = "1e450a4a4c53bf197ad6402c564b9f7a53539385918ef8f12bdf430a61036590"; + }; + + buildInputs = [ bash ]; + + preConfigure = '' + substituteInPlace test_subprocess32.py \ + --replace '/usr/' '${bash}/' + ''; + + doCheck = !isPyPy; + checkPhase = '' + ${python.interpreter} test_subprocess32.py + ''; + + meta = { + homepage = https://pypi.python.org/pypi/subprocess32; + description = "Backport of the subprocess module from Python 3.2.5 for use on 2.x"; + maintainers = with lib.maintainers; [ garbas ]; + }; +} \ No newline at end of file diff --git a/pkgs/development/python-modules/tensorflow-tensorboard/default.nix b/pkgs/development/python-modules/tensorflow-tensorboard/default.nix new file mode 100644 index 000000000000..9f48b8fb971a --- /dev/null +++ b/pkgs/development/python-modules/tensorflow-tensorboard/default.nix @@ -0,0 +1,43 @@ +{ stdenv +, fetchPypi +, buildPythonPackage +, isPy3k +, bleach_1_5_0 +, numpy +, werkzeug +, protobuf +, markdown +}: + +# tensorflow is built from a downloaded wheel, because the upstream +# project's build system is an arcane beast based on +# bazel. Untangling it and building the wheel from source is an open +# problem. + +buildPythonPackage rec { + pname = "tensorflow-tensorboard"; + version = "0.1.5"; + name = "${pname}-${version}"; + format = "wheel"; + + src = fetchPypi ({ + pname = "tensorflow_tensorboard"; + inherit version; + format = "wheel"; + } // (if isPy3k then { + python = "py3"; + sha256 = "0sfia05y1mzgy371faj96vgzhag1rgpa3gnbz9w1fay13jryw26x"; + } else { + python = "py2"; + sha256 = "0qx4f55zp54x079kxir4zz5b1ckiglsdcb9afz5wcdj6af4a6czg"; + })); + + propagatedBuildInputs = [ bleach_1_5_0 numpy werkzeug protobuf markdown ]; + + meta = with stdenv.lib; { + description = "TensorFlow helps the tensors flow"; + homepage = http://tensorflow.org; + license = licenses.asl20; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/development/python-modules/tensorflow/default.nix b/pkgs/development/python-modules/tensorflow/default.nix index 5019f17f788a..ab604c173004 100644 --- a/pkgs/development/python-modules/tensorflow/default.nix +++ b/pkgs/development/python-modules/tensorflow/default.nix @@ -1,7 +1,8 @@ { stdenv +, lib , fetchurl , buildPythonPackage -, isPy36, isPy35, isPy27 +, isPy3k, isPy35, isPy36, isPy27 , cudaSupport ? false , cudatoolkit ? null , cudnn ? null @@ -9,10 +10,10 @@ , numpy , six , protobuf -, swig -, werkzeug , mock +, backports_weakref , zlib +, tensorflow-tensorboard }: assert cudaSupport -> cudatoolkit != null @@ -29,10 +30,10 @@ assert ! (stdenv.isDarwin && cudaSupport); buildPythonPackage rec { pname = "tensorflow"; - version = "1.1.0"; + version = "1.3.0"; name = "${pname}-${version}"; format = "wheel"; - disabled = ! (isPy36 || isPy35 || isPy27); + disabled = ! (isPy35 || isPy36 || isPy27); src = let tfurl = sys: proc: pykind: @@ -47,69 +48,77 @@ buildPythonPackage rec { darwin.cpu = { py2 = { url = tfurl "mac" "cpu" "py2-none-any" ; - sha256 = "1fgf26lw0liqxc9pywc8y2mj8l1mv48nhkav0pag9vavdacb9mqr"; + sha256 = "0nkymqbqjx8rsmc8vkc26cfsg4hpr6lj9zrwhjnfizvkzbbsh5z4"; }; py3 = { url = tfurl "mac" "cpu" "py3-none-any" ; - sha256 = "0z5p1fra7bih0vqn618i2w3vyy8d1rkc72k7bmjq0rw8msl717ia"; + sha256 = "1rj4m817w3lajnb1lgn3bwfwwk3qwvypyx11dim1ybakbmsc1j20"; }; }; linux-x86_64.cpu = { py2 = { url = tfurl "linux" "cpu" "cp27-none-linux_x86_64"; - sha256 = "0ld3hqx3idxk0zcrvn3p9yqnmx09zsj3mw66jlfw6fkv5hznx8j2"; + sha256 = "09pcyx0yfil4dm6cij8n3907pfgva07a38avrbai4qk5h6hxm8w9"; }; py35 = { url = tfurl "linux" "cpu" "cp35-cp35m-linux_x86_64"; - sha256 = "0ahz9222rzqrk43lb9w4m351klkm6mlnnvw8xfqip28vbmymw90b"; + sha256 = "0p10zcf41pi33bi025fibqkq9rpd3v0rrbdmc9i9yd7igy076a07"; }; py36 = { url = tfurl "linux" "cpu" "cp36-cp36m-linux_x86_64"; - sha256 = "1a2cc8ihl94iqff76nxg6bq85vfb7sj5cvvi9sxy2f43k32fi4lv"; + sha256 = "1qm8lm2f6bf9d462ybgwrz0dn9i6cnisgwdvyq9ssmy2f1gp8hxk"; }; - }; linux-x86_64.cuda = { py2 = { url = tfurl "linux" "gpu" "cp27-none-linux_x86_64"; - sha256 = "1baa9jwr6f8f62dyx6isbw8yyrd0pi1dz1srjblfqsyk1x3pnfvh"; + sha256 = "10yyyn4g2fsv1xgmw99bbr0fg7jvykay4gb5pxrrylh7h38h6wah"; }; py35 = { url = tfurl "linux" "gpu" "cp35-cp35m-linux_x86_64"; - sha256 = "0606m2awy0ifhniy8lsyhd0xc388dgrwksn87989xlgy90wpxi92"; + sha256 = "0icwnhkcf3fxr6bmbihqzipnn4pxybd06qv7l3k0p4xdgycwzmzk"; }; py36 = { url = tfurl "linux" "gpu" "cp36-cp36m-linux_x86_64"; - sha256 = "0lvbmfa87qzrajadpsf13gi3l71vryzkryzqfvkykivqrdjsvj8q"; + sha256 = "12g3akkr083gs3sisjbmm0lpsk8phn3dvy7jjfadfxshqc7za14i"; }; - }; }; in fetchurl ( if stdenv.isDarwin then - if isPy27 then - dls.darwin.cpu.py2 - else + if isPy3k then dls.darwin.cpu.py3 - else if isPy36 then - if cudaSupport then - dls.linux-x86_64.cuda.py36 - else dls.linux-x86_64.cpu.py36 - else if isPy35 then - if cudaSupport then - dls.linux-x86_64.cuda.py35 - else dls.linux-x86_64.cpu.py35 + else + dls.darwin.cpu.py2 else - if cudaSupport then - dls.linux-x86_64.cuda.py2 + if isPy35 then + if cudaSupport then + dls.linux-x86_64.cuda.py35 + else + dls.linux-x86_64.cpu.py35 + else if isPy36 then + if cudaSupport then + dls.linux-x86_64.cuda.py36 + else + dls.linux-x86_64.cpu.py36 else - dls.linux-x86_64.cpu.py2 + if cudaSupport then + dls.linux-x86_64.cuda.py2 + else + dls.linux-x86_64.cpu.py2 ); - propagatedBuildInputs = with stdenv.lib; - [ numpy six protobuf swig werkzeug mock ] - ++ optionals cudaSupport [ cudatoolkit cudnn stdenv.cc ]; + propagatedBuildInputs = + [ numpy six protobuf mock backports_weakref ] + ++ lib.optional (!isPy36) tensorflow-tensorboard + ++ lib.optionals cudaSupport [ cudatoolkit cudnn stdenv.cc ]; + + # tensorflow-gpu depends on tensorflow_tensorboard, which cannot be + # built at the moment (some of its dependencies do not build + # [htlm5lib9999999 (seven nines) -> tensorboard], and it depends on an old version of + # bleach) Hence we disable dependency checking for now. + installFlags = lib.optional isPy36 "--no-dependencies"; # Note that we need to run *after* the fixup phase because the # libraries are loaded at runtime. If we run in preFixup then diff --git a/pkgs/development/python-modules/urllib3/default.nix b/pkgs/development/python-modules/urllib3/default.nix index 10021e14f126..f030ef74e63f 100644 --- a/pkgs/development/python-modules/urllib3/default.nix +++ b/pkgs/development/python-modules/urllib3/default.nix @@ -12,6 +12,8 @@ buildPythonPackage rec { sha256 = "0kyvc9zdlxr5r96bng5rhm9a6sfqidrbvvkz64s76qs5267dli6c"; }; + outputs = [ "out" "dev" ]; + NOSE_EXCLUDE = stdenv.lib.concatStringsSep "," [ "test_headers" "test_headerdict" "test_can_validate_ip_san" "test_delayed_body_read_timeout" "test_timeout_errors_cause_retries" "test_select_multiple_interrupts_with_event" |