3
0
Fork 0
forked from mirrors/nixpkgs

pythonPackages.demjson: fix tests, enable on Python 3.x

In commit 6ba044c166, the demjson package was
disabled on Python 3.x with the comment that it doesn't seem to support any
Python 3.x versions.  But looking at the upstream repository, they do seem to
attempt to support Python 3 -- it turns out the failure on our end was caused by
some issue with trying to run `setup.py test` on a 2to3-using codebase with no
test suite (?).

In any case, this package's test suite doesn't seem to use the setuptools
mechanism, so in this commit I override the checkPhase to run the upstream tests
in the correct way.  This fixes the build on all Python versions.

EDIT 2021-01-08: rebased on top of PR #108378 which had explicitly disabled the
tests on all Python versions.
This commit is contained in:
Keshav Kini 2020-12-27 05:33:05 -08:00 committed by Bjørn Forsman
parent 85449b21bc
commit b1d53b04ea

View file

@ -1,17 +1,19 @@
{ stdenv, buildPythonPackage, fetchPypi, isPy3k }: { stdenv, python, buildPythonPackage, fetchPypi, isPy3k }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "demjson"; pname = "demjson";
version = "2.2.4"; version = "2.2.4";
disabled = isPy3k;
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "0ygbddpnvp5lby6mr5kz60la3hkvwwzv3wwb3z0w9ngxl0w21pii"; sha256 = "0ygbddpnvp5lby6mr5kz60la3hkvwwzv3wwb3z0w9ngxl0w21pii";
}; };
doCheck = false; checkPhase = stdenv.lib.optionalString isPy3k ''
pythonImportsCheck = [ "demjson" ]; ${python.interpreter} -m lib2to3 -w test/test_demjson.py
'' + ''
${python.interpreter} test/test_demjson.py
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Encoder/decoder and lint/validator for JSON (JavaScript Object Notation)"; description = "Encoder/decoder and lint/validator for JSON (JavaScript Object Notation)";