Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test suite failures with Python3.8 #1681

Closed
tillea opened this issue Dec 1, 2019 · 3 comments
Closed

Test suite failures with Python3.8 #1681

tillea opened this issue Dec 1, 2019 · 3 comments

Comments

@tillea
Copy link

tillea commented Dec 1, 2019

Hi,
Debian is switching to Python3.8 and we realised that there are test suite failures. These are reported in a bug report.

======================================================================
ERROR: test_munging_invalid_type_to_self_type
(skbio.sequence.tests.test_sequence.TestDistance)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/tests/test_sequence.py",
line 2369, in test_munging_invalid_type_to_self_type
    Sequence("ACGT").distance(42)
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/_sequence.py",
line 1539, in distance
    other = self._munge_to_self_type(other, 'distance')
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/_sequence.py",
line 2161, in _munge_to_self_type
    return self.__class__(other)
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/_sequence.py",
line 622, in __init__
    s = np.frombuffer(sequence, dtype=np.uint8)
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_init_invalid_sequence (skbio.sequence.tests.test_sequence.TestSequence)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/tests/test_sequence.py",
line 465, in test_init_invalid_sequence
    Sequence(('a', 'b', 'c'))
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/_sequence.py",
line 622, in __init__
    s = np.frombuffer(sequence, dtype=np.uint8)
TypeError: a bytes-like object is required, not 'tuple'

======================================================================
FAIL: test_no_variation_pearson (skbio.stats.distance.tests.test_mantel.MantelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/stats/distance/tests/test_mantel.py",
line 250, in test_no_variation_pearson
    npt.assert_equal(obs, (0.0, 1.0, 3))
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line
355, in assert_equal
    assert_equal(actual[k], desired[k], 'item=%r\n%s' % (k, err_msg), verbose)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line
427, in assert_equal
    raise AssertionError(msg)
AssertionError:
Items are not equal:
item=0

 ACTUAL: nan
 DESIRED: 0.0

======================================================================
FAIL: test_one_sided_less (skbio.stats.distance.tests.test_mantel.MantelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/stats/distance/tests/test_mantel.py",
line 189, in test_one_sided_less
    self.assertEqual(obs, (1, 1, 3))
AssertionError: Tuples differ: (0.9999999999999998, 1.0, 3) != (1, 1, 3)

First differing element 0:
0.9999999999999998
1

- (0.9999999999999998, 1.0, 3)
+ (1, 1, 3)

======================================================================
FAIL: Test against a reference implementation from R's ape package
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/stats/ordination/tests/test_principal_coordinate_analysis.py",
line 250, in test_pcoa_biplot_from_ape
    assert_ordination_results_equal(obs, exp, ignore_directionality=True,
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/util/_testing.py",
line 126, in assert_ordination_results_equal
    _assert_frame_equal(left.features, right.features,
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/util/_testing.py",
line 171, in _assert_frame_equal
    npt.assert_almost_equal(left_values, right_values, decimal=decimal)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line
584, in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line
1027, in assert_array_almost_equal
    assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line
769, in assert_array_compare
    flagged = func_assert_same_pos(x, y, func=isnan, hasval='nan')
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line
745, in func_assert_same_pos
    raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 7 decimals

x and y nan location mismatch:
 x: array([[-2.5170346e-02, -3.8742000e-02,  3.7030794e-02, -1.8248587e-02,
        -1.2974103e-03,  8.1410679e-04, -1.7370121e-02,  3.6121106e-02,
                   nan],...
 y: array([[-2.5170346e-02, -3.8742000e-02,  3.7030794e-02, -1.8248587e-02,
        -1.2974103e-03,  8.1410679e-04, -1.7370121e-02,  3.6121106e-02,
         0.0000000e+00],...

======================================================================
FAIL: test__identify_sample_groups_not_strict
(skbio.stats.tests.test_power.PowerAnalysisTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_skbio/build/skbio/stats/tests/test_power.py",
line 496, in test__identify_sample_groups_not_strict
    npt.assert_array_equal(known_pairs[k][i], test_pairs[k][i])
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line
917, in assert_array_equal
    assert_array_compare(operator.__eq__, x, y, err_msg=err_msg,
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line
841, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not equal

Mismatch: 100%
 x: array(['MM', 'WM'], dtype=object)
 y: array(['WM', 'MM'], dtype=object)

----------------------------------------------------------------------
Ran 2340 tests in 55.022s

FAILED (SKIP=30, errors=2, failures=4)

Kind regards, Andreas.

@ebolyen
Copy link
Contributor

ebolyen commented Dec 1, 2019

Thanks @tillea, this doesn't look like Python 3.8 so much as the scipy change found in #1678

The first two errors in the report have also been corrected in the master branch (they are also not very serious, a different exception is being raised by numpy, but we were testing for that).

This one looks new though, seems the order swapped, but I'm not sure if the order matters for that part of the API.

Mismatch: 100%
 x: array(['MM', 'WM'], dtype=object)
 y: array(['WM', 'MM'], dtype=object)

@tillea
Copy link
Author

tillea commented Dec 4, 2019

I checked now with scipy 1.3.3. I can confirm that two failures are gone now. Here is the updated failure log:

======================================================================
ERROR: test_munging_invalid_type_to_self_type (skbio.sequence.tests.test_sequence.TestDistance)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/tests/test_sequence.py", line 2369, in test_munging_invalid_type_to_self_type
    Sequence("ACGT").distance(42)
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/_sequence.py", line 1539, in distance
    other = self._munge_to_self_type(other, 'distance')
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/_sequence.py", line 2161, in _munge_to_self_type
    return self.__class__(other)
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/_sequence.py", line 622, in __init__
    s = np.frombuffer(sequence, dtype=np.uint8)
TypeError: a bytes-like object is required, not 'int'

======================================================================
ERROR: test_init_invalid_sequence (skbio.sequence.tests.test_sequence.TestSequence)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/tests/test_sequence.py", line 465, in test_init_invalid_sequence
    Sequence(('a', 'b', 'c'))
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/sequence/_sequence.py", line 622, in __init__
    s = np.frombuffer(sequence, dtype=np.uint8)
TypeError: a bytes-like object is required, not 'tuple'

======================================================================
FAIL: Test against a reference implementation from R's ape package
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/stats/ordination/tests/test_principal_coordinate_analysis.py", line 250, in test_pcoa_biplot_from_ape
    assert_ordination_results_equal(obs, exp, ignore_directionality=True,
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/util/_testing.py", line 126, in assert_ordination_results_equal
    _assert_frame_equal(left.features, right.features,
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/util/_testing.py", line 171, in _assert_frame_equal
    npt.assert_almost_equal(left_values, right_values, decimal=decimal)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 584, in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1027, in assert_array_almost_equal
    assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 769, in assert_array_compare
    flagged = func_assert_same_pos(x, y, func=isnan, hasval='nan')
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 745, in func_assert_same_pos
    raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 7 decimals

x and y nan location mismatch:
 x: array([[-2.5170346e-02, -3.8742000e-02,  3.7030794e-02, -1.8248587e-02,
        -1.2974103e-03,  8.1410679e-04, -1.7370121e-02,  3.6121106e-02,
                   nan],...
 y: array([[-2.5170346e-02, -3.8742000e-02,  3.7030794e-02, -1.8248587e-02,
        -1.2974103e-03,  8.1410679e-04, -1.7370121e-02,  3.6121106e-02,
         0.0000000e+00],...

======================================================================
FAIL: test__identify_sample_groups_not_strict (skbio.stats.tests.test_power.PowerAnalysisTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-skbio-0.5.5/.pybuild/cpython3_3.8_skbio/build/skbio/stats/tests/test_power.py", line 496, in test__identify_sample_groups_not_strict
    npt.assert_array_equal(known_pairs[k][i], test_pairs[k][i])
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 917, in assert_array_equal
    assert_array_compare(operator.__eq__, x, y, err_msg=err_msg,
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 841, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not equal

Mismatch: 100%
 x: array(['MM', 'WM'], dtype=object)
 y: array(['WM', 'MM'], dtype=object)

----------------------------------------------------------------------
Ran 2340 tests in 68.250s

FAILED (SKIP=30, errors=2, failures=2)

Any idea how to deal with these?
Kind regards, Andreas.

@thermokarst
Copy link
Contributor

This appears to be resolved as of 8eba594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants