aenum: make tests pass (#33805)

For Python 2, tests were failing because they depended on a particular
way of executing the tests module as it defined a global variable
and created a temporary file. Running it through setup.py didn't work.
Invoking it directly solved the issue.

For Python 3, aenum tests were disabled, however, they did't have to
fail. Configuring UTF8 locale resolved the failure that was happening
after the above fix for Python 2 was applied.
This commit is contained in:
Yurii Rashkovskii 2018-01-16 01:40:40 -08:00 committed by Jörg Thalheim
parent cf3cc25bb2
commit 91e9989911

View file

@ -1,4 +1,4 @@
{ stdenv, fetchPypi, buildPythonPackage, isPy3k }:
{ stdenv, fetchPypi, buildPythonPackage, python, isPy3k, glibcLocales }:
buildPythonPackage rec {
pname = "aenum";
@ -10,12 +10,17 @@ buildPythonPackage rec {
sha256 = "d98bc55136d696fcf323760c3db0de489da9e41fd51283fa6f90205deb85bf6a";
};
doCheck = !isPy3k;
# The following tests fail (only in python3
# test_convert (aenum.test.TestIntEnumConvert)
# test_convert_value_lookup_priority (aenum.test.TestIntEnumConvert)
# test_convert (aenum.test.TestIntEnumConvert)
# test_convert_value_lookup_priority (aenum.test.TestIntEnumConvert)
# For Python 3, locale has to be set to en_US.UTF-8 for
# tests to pass
checkInputs = if isPy3k then [ glibcLocales ] else [];
checkPhase = ''
runHook preCheck
${if isPy3k then "export LC_ALL=en_US.UTF-8" else ""}
PYTHONPATH=`pwd` ${python.interpreter} aenum/test.py
runHook postCheck
'';
meta = {
description = "Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants";