-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tests fail when run on pytest 5.0.0 #1
Comments
This happens because in 5.0.0, the exception object does not include the text of the exception, just the type:
so when the test looks for a specific substring it doesn't find it. The solution is to print the the .value of the exception to get the full text. I tested this fix on pytest 5.0.0, 4.6.3, and 3.10.1. |
pytest 5.0.0 was released June 28, 2019. This issue is the one that caused the tests to fail |
This fix is affected by StingraySoftware#416 and the temporary hack listed there was used to get the tests passing. |
…he exception. pytest 5.0.0 no longer displays the custom text with str(e)
`On Pytest 4.6.3 the test pass fine but on 5.0.0 some fail:
platform linux -- Python 3.5.2, pytest-5.0.0, py-1.8.0, pluggy-0.12.0
Running tests with Astropy version 3.2.1.
Running tests in stingray docs.
Date: 2019-06-29T13:53:19
Platform: Linux-4.4.0-150-generic-x86_64-with-Ubuntu-16.04-xenial
Executable: /usr/bin/python3
Full Python Version:
3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609]
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15
Numpy: 1.16.4
Scipy: 1.3.0
Matplotlib: 3.0.3
h5py: 2.9.0
Pandas: 0.24.2
astropy_helpers: 3.2.1
Using Astropy options: remote_data: none.
rootdir: /tmp/stingray-test-gaqwq6do/lib/python3.5/site-packages, inifile: setup.cfg
plugins: doctestplus-0.3.0, arraydiff-0.3, remotedata-0.3.1, openfiles-0.3.2
...
====================================================================================================== FAILURES =======================================================================================================
_________________________________________________________________________________________ TestAll.test_phaseogram_bad_weights _________________________________________________________________________________________
self = <stingray.pulse.tests.test_search.TestAll object at 0x7f73361f9400>
E TypeError: Can't convert 'ExceptionInfo' object to str implicitly
stingray/pulse/tests/test_search.py:47: TypeError
__________________________________________________________________________________ TestAll.test_epoch_folding_search_expocorr_fails ___________________________________________________________________________________
self = <stingray.pulse.tests.test_search.TestAll object at 0x7f732815dba8>
E AssertionError: assert 'To calculate exposure correction' in ''
E + where '' = str()
stingray/pulse/tests/test_search.py:173: AssertionError
_______________________________________________________________________________________ TestAll.test_z_n_search_expocorr_fails ________________________________________________________________________________________
self = <stingray.pulse.tests.test_search.TestAll object at 0x7f73280dbfd0>
E AssertionError: assert 'To calculate exposure correction' in ''
E + where '' = str()
stingray/pulse/tests/test_search.py:292: AssertionError
_______________________________________________________________________________________ TestGTI.test_gti_mask_fails_empty_time ________________________________________________________________________________________
self = <stingray.tests.test_gti.TestGTI object at 0x7f73272bf5c0>
E AssertionError: assert 'empty time array' in ''
E + where '' = str()
stingray/tests/test_gti.py:67: AssertionError
________________________________________________________________________________________ TestGTI.test_gti_mask_fails_empty_gti ________________________________________________________________________________________
self = <stingray.tests.test_gti.TestGTI object at 0x7f73272c7438>
E AssertionError: assert 'empty GTI array' in ''
E + where '' = str()
stingray/tests/test_gti.py:74: AssertionError
_________________________________________________________________________________________ TestGTI.test_check_gti_fails_empty __________________________________________________________________________________________
self = <stingray.tests.test_gti.TestGTI object at 0x7f73272d3710>
E AssertionError: assert 'Empty' in ''
E + where '' = str()
stingray/tests/test_gti.py:244: AssertionError
========================================================================== 6 failed, 747 passed, 8 skipped, 7325 warnings in 221.80 seconds ===========================================================================`
The text was updated successfully, but these errors were encountered: