jazzband / geojson

Python bindings and utilities for GeoJSON
https://pypi.python.org/pypi/geojson/
BSD 3-Clause "New" or "Revised" License
913 stars 121 forks source link

Failing test test_features.FeaturesTest #175

Open phodina opened 2 years ago

phodina commented 2 years ago

Hi, I'm porting the package to GNU Guix. One of the tests test_features.FeaturesTest is failing.

Any suggestion on how to fix it?

$ python3 --version
Python 3.9.6
starting phase `check'
running "python setup.py" with command "test" and parameters ()
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
writing geojson.egg-info/PKG-INFO
writing dependency_links to geojson.egg-info/dependency_links.txt
writing top-level names to geojson.egg-info/top_level.txt
adding license file 'LICENSE.rst' (matched pattern 'LICEN[CS]E*')
reading manifest file 'geojson.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.txt' under directory 'tests'
writing manifest file 'geojson.egg-info/SOURCES.txt'
running build_ext
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
writing geojson.egg-info/PKG-INFO
writing dependency_links to geojson.egg-info/dependency_links.txt
writing top-level names to geojson.egg-info/top_level.txt
adding license file 'LICENSE.rst' (matched pattern 'LICEN[CS]E*')
reading manifest file 'geojson.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.txt' under directory 'tests'
writing manifest file 'geojson.egg-info/SOURCES.txt'
running build_ext
test_errors (test_base.BaseTestCase) ... ok
test_to_instance (test_base.BaseTestCase) ... ok
test_delattr (test_base.OperatorOverloadingTestCase) ... ok
test_getattr (test_base.OperatorOverloadingTestCase) ... ok
test_setattr (test_base.OperatorOverloadingTestCase) ... ok
test_type_property (test_base.TypePropertyTestCase) ... ok
test_copy_construction (test_constructor.TestGeoJSONConstructor) ... ok
test_nested_constructors (test_constructor.TestGeoJSONConstructor) ... ok
test_dict (test_coords.CoordsTestCase) ... ok
test_featurecollection (test_coords.CoordsTestCase) ... ok
test_map_feature (test_coords.CoordsTestCase) ... ok
test_map_invalid (test_coords.CoordsTestCase) ... ok
test_map_linestring (test_coords.CoordsTestCase) ... ok
test_map_multipolygon (test_coords.CoordsTestCase) ... ok
test_map_point (test_coords.CoordsTestCase) ... ok
test_map_polygon (test_coords.CoordsTestCase) ... ok
test_multipolygon (test_coords.CoordsTestCase) ... ok
test_point (test_coords.CoordsTestCase) ... ok
test_point_feature (test_coords.CoordsTestCase) ... ok
test_point_rounding (test_coords.CoordsTestCase) ... ok
test_feature_class (test_features.FeaturesTest)
Test the Feature class ... ERROR
test_geo_interface (test_features.FeaturesTest) ... ok
test_protocol (test_features.FeaturesTest)
A dictionary can satisfy the protocol ... ok
test_unicode_properties (test_features.FeaturesTest) ... ok
test_GeoJSON (test_geo_interface.EncodingDecodingTest) ... ok
test_decode (test_geo_interface.EncodingDecodingTest)
Ensure a GeoJSON string can be decoded into GeoJSON objects ... ok
test_decode_nested (test_geo_interface.EncodingDecodingTest)
Ensure a GeoJSON string can be decoded into nested GeoJSON objects ... ok
test_encode (test_geo_interface.EncodingDecodingTest)
Ensure objects that implement __geo_interface__ can be encoded into ... ok
test_encode_nested (test_geo_interface.EncodingDecodingTest)
Ensure nested objects that implement __geo_interface__ can be encoded ... ok
test_invalid (test_geo_interface.EncodingDecodingTest) ... ok
test_mapping (test_geo_interface.EncodingDecodingTest) ... ok
test_null_geometry_explicit (test_null_geometries.NullGeometriesTest) ... ok
test_null_geometry_implicit (test_null_geometries.NullGeometriesTest) ... ok
test_decode_inf (test_strict_json.StrictJsonTest)
Ensure Error is raised when decoding Infinity or -Infinity ... ok
test_decode_nan (test_strict_json.StrictJsonTest)
Ensure Error is raised when decoding NaN ... ok
test_encode_inf (test_strict_json.StrictJsonTest)
Ensure Error is raised when encoding inf or -inf ... ok
test_encode_nan (test_strict_json.StrictJsonTest)
Ensure Error is raised when encoding nan ... ok
test_valid_jsonobject (test_validation.TestValidationGeoJSONObject) ... ok
test_invalid_geometry_with_validate (test_validation.TestValidationGeometry) ... ok
test_invalid_geometry_without_validate (test_validation.TestValidationGeometry) ... ok
test_not_number (test_validation.TestValidationGeometry) ... ok
test_not_sequence (test_validation.TestValidationGeometry) ... ok
test_valid_geometry (test_validation.TestValidationGeometry) ... ok
test_valid_geometry_with_elevation (test_validation.TestValidationGeometry) ... ok
test_invalid_geometrycollection (test_validation.TestValidationGeometryCollection) ... ok
test_valid_geometrycollection (test_validation.TestValidationGeometryCollection) ... ok
test_invalid_linestring (test_validation.TestValidationLineString) ... ok
test_valid_linestring (test_validation.TestValidationLineString) ... ok
test_invalid_multilinestring (test_validation.TestValidationMultiLineString) ... ok
test_valid_multilinestring (test_validation.TestValidationMultiLineString) ... ok
test_invalid_multipolygon (test_validation.TestValidationMultiPolygon) ... ok
test_valid_multipolygon (test_validation.TestValidationMultiPolygon) ... ok
test_invalid_multipoint (test_validation.TestValidationMultipoint) ... ok
test_valid_multipoint (test_validation.TestValidationMultipoint) ... ok
test_valid_multipoint_with_elevation (test_validation.TestValidationMultipoint) ... ok
test_invalid_point (test_validation.TestValidationPoint) ... ok
test_valid_point (test_validation.TestValidationPoint) ... ok
test_valid_point_with_elevation (test_validation.TestValidationPoint) ... ok
test_invalid_polygon (test_validation.TestValidationPolygon) ... ok
test_valid_polygon (test_validation.TestValidationPolygon) ... ok
/tmp/guix-build-python-geojson-2.5.0.drv-0/geojson-2.5.0/README.rst
Doctest: README.rst ... ok

======================================================================
ERROR: test_feature_class (test_features.FeaturesTest)
Test the Feature class
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/guix-build-python-geojson-2.5.0.drv-0/geojson-2.5.0/tests/test_features.py", line 85, in test_feature_class
    feature = geojson.loads(json, object_hook=factory, encoding="utf-8")
  File "/tmp/guix-build-python-geojson-2.5.0.drv-0/geojson-2.5.0/geojson/codec.py", line 51, in loads
    return json.loads(s,
  File "/gnu/store/p5fgysbcnnp8b1d91mrvjvababmczga0-python-3.9.6/lib/python3.9/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
TypeError: __init__() got an unexpected keyword argument 'encoding'

----------------------------------------------------------------------
Ran 61 tests in 0.012s

FAILED (errors=1)
Test failed: <unittest.runner.TextTestResult run=61 errors=1 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=61 errors=1 failures=0>
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "python" arguments: ("-c" "import setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))" "test") exit-status: 1 term-signal: #f stop-signal: #f>
phase `check' failed after 0.3 seconds
command "python" "-c" "import setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))" "test" failed with status 1
builder for `/gnu/store/jnzsz15kp7ykzrs72xyavigazm8hv8fl-python-geojson-2.5.0.drv' failed with exit code 1
build of /gnu/store/jnzsz15kp7ykzrs72xyavigazm8hv8fl-python-geojson-2.5.0.drv failed
View build log at '/var/log/guix/drvs/jn/zsz15kp7ykzrs72xyavigazm8hv8fl-python-geojson-2.5.0.drv.bz2'.
cannot build derivation `/gnu/store/iv9f0v2dpfxpmcikzbbnkja741mzar0v-wfetch-.drv': 1 dependencies couldn't be built
guix build: error: build of `/gnu/store/iv9f0v2dpfxpmcikzbbnkja741mzar0v-wfetch-.drv' failed
trcmohitmandokhot commented 1 year ago

Hi, I am not sure if this is an issue due to an old version of the geojson package. I tried running tests on python3.9.6 and here is the test log with latest version of code. tests_py396.log Also it appears that #151 already fixed this issue.

rayrrr commented 1 year ago

@phodina please try version 3.0.0 (now available via PyPI / pip install), as it contains the fix for this issue, and report back on your experience porting that version if possible. Thanks.