Chilipp / straditize

⛔️ Python package for digitizing pollen diagrams
https://straditize.readthedocs.io
GNU General Public License v3.0
14 stars 5 forks source link

Tests abort on MacOS #8

Closed sgrieve closed 5 years ago

sgrieve commented 5 years ago

Problem description

Hello from the JOSS review openjournals/joss-reviews#1216.

I have run into some trouble getting the tests to pass on my machine. Straditize itself seems to be working fine however.

When I run py.test or python setup.py test I get the following output:

[stuart:~/straditize] [strad] master 21m1s ± py.test
============================= test session starts ==============================
platform darwin -- Python 3.6.3, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
rootdir: /Users/stuart/straditize, inifile:
collected 179 items

tests/test_binary.py .......                                             [  3%]
tests/test_straditizer.py ..                                             [  5%]
tests/widgets/test_axes_translations.py ..                               [  6%]
tests/widgets/test_beginner.py ............                              [ 12%]
tests/widgets/test_colnames.py sss..s                                    [ 16%]
tests/widgets/test_command_line.py Abort trap: 6

Environment information

I am running MacOS Sierra 10.12.6 with Python 3.6.3. I have created a clean Python 3.6.3 virtual environment in which I have run python setup.py install, pip install pyqt5 and pip install pytest.

psyplot -aV # Paste the output of the command ``psyplot -aV`` (ran from the command line) ``` psyplot: requirements: matplotlib: 3.0.2 numpy: 1.16.1 pandas: 0.24.1 python: 3.6.3 |Anaconda, Inc.| (default, Oct 6 2017, 12:04:38) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] xarray: 0.11.3 version: 1.2.0 psyplot_gui: requirements: pyqt: 5.11.3 qt: 5.11.2 qtconsole: 4.4.3 version: 1.2.2 ```
straditize -V # Paste the output of the command ``straditize -V`` (ran from the command line) ``` 0.1.0 ```
Chilipp commented 5 years ago

Dear @sgrieve, thanks for reporting this! May I ask you how you installed straditize (pip install ., python setup.py install, conda install, etc.) and to provide the output of pip list (or conda list if you used conda)

sgrieve commented 5 years ago

Hi @Chilipp I installed using python setup.py install

and the output of pip list is:

Package                  Version
------------------------ ----------
alabaster                0.7.12
appnope                  0.1.0
atomicwrites             1.3.0
attrs                    18.2.0
Babel                    2.6.0
backcall                 0.1.0
certifi                  2018.11.29
cftime                   1.0.3.4
chardet                  3.0.4
cloudpickle              0.7.0
cycler                   0.10.0
dask                     1.1.1
decorator                4.3.2
docrep                   0.2.5
docutils                 0.14
et-xmlfile               1.0.1
fasteners                0.14.1
funcargparse             0.2.0
idna                     2.8
imagesize                1.1.0
ipykernel                5.1.0
ipython                  7.2.0
ipython-genutils         0.2.0
jdcal                    1.4
jedi                     0.13.2
Jinja2                   2.10
jupyter-client           5.2.4
jupyter-core             4.4.0
kiwisolver               1.0.1
MarkupSafe               1.1.0
matplotlib               3.0.2
monotonic                1.5
more-itertools           5.0.0
netCDF4                  1.4.2
networkx                 2.2
numpy                    1.16.1
openpyxl                 2.6.0
packaging                19.0
pandas                   0.24.1
parso                    0.3.3
pexpect                  4.6.0
pickleshare              0.7.5
Pillow                   5.4.1
pip                      19.0.1
pluggy                   0.8.1
prompt-toolkit           2.0.8
psyplot                  1.2.0
psyplot-gui              1.2.2
ptyprocess               0.6.0
py                       1.7.0
Pygments                 2.3.1
pyparsing                2.3.1
PyQt5                    5.11.3
PyQt5-sip                4.19.13
pytest                   4.2.0
python-dateutil          2.8.0
pytz                     2018.9
PyWavelets               1.0.1
PyYAML                   4.2b4
pyzmq                    17.1.2
qtconsole                4.4.3
requests                 2.21.0
scikit-image             0.14.2
scipy                    1.2.0
setuptools               40.8.0
six                      1.12.0
snowballstemmer          1.2.1
Sphinx                   1.8.4
sphinx-rtd-theme         0.4.2
sphinxcontrib-websupport 1.1.0
straditize               0.1.0
toolz                    0.9.0
tornado                  6.0a1
traitlets                4.3.2
urllib3                  1.24.1
wcwidth                  0.1.7
wheel                    0.32.3
xarray                   0.11.3
Chilipp commented 5 years ago

Dear @sgrieve! Thanks again for reporting this issue. Unfortunately PyQt always aborts the test run and therefore makes it difficult to debug. Nevertheless, I think I figured it out by running py.test -s to not capture the stdout. With this, I got the error message

Traceback (most recent call last):
  File "/Users/psommer/Documents/myplots-scripts/psyplot-gui/psyplot_gui/console.py", line 314, in eventFilter
    return super().eventFilter(*args, **kwargs)
  File "/Users/psommer/miniconda3/envs/test2/lib/python3.7/site-packages/qtconsole/console_widget.py", line 407, in eventFilter
    self._trigger_is_complete_callback()
  File "/Users/psommer/miniconda3/envs/test2/lib/python3.7/site-packages/qtconsole/console_widget.py", line 578, in _trigger_is_complete_callback
    if self._is_complete_msg_id is not None:
AttributeError: 'ConsoleWidget' object has no attribute '_is_complete_msg_id'

This is one of the difficulties with unittests and PyQt. The ConsoleWidget this error comes from has actually already been closed and is a remainder from the previous TestCase. Nevertheless PyQt still calls the eventFilter method of this widget which produces the error above.

Unfortunately the created widget is not garbage collected although the corresponding widget has already been closed. Usually this is not a problem in straditize (you would not close the console and open a new one) but within the unittests I create and close lot's of widgets.

However, I fixed this in the psyplot-gui package (https://github.com/Chilipp/psyplot-gui/commit/23656d1e78d59fbc7f4da60a2c19e5a5e5448ada) and made a new release (1.2.3) that is available on PyPi and will soon be available from the conda-forge channel (see https://github.com/conda-forge/psyplot-gui-feedstock/pull/9) and is already available on the Chilipp conda channel.

Could you please checkout the pip-install-fix branch of straditize (see https://anaconda.org/Chilipp/psyplot-gui) and check that the tests run through? Please also consider the changed instructions on how to run the tests and how to install it from source in the docs. The problem with pyqt5 through pip should be solved now and is also addressed in the CI build.

Thank you very much for your engagement! You should not, but if you still encounter the previous problem (or any new problem), please include the output of py.test -s in your report.

sgrieve commented 5 years ago

Hi @Chilipp The tests all now pass for me and the changes to the documentation are excellent. Great work!

Chilipp commented 5 years ago

Thank you 👍 And thanks for the quick response! I will close this issue then when https://github.com/Chilipp/straditize/pull/6 is merged

Chilipp commented 5 years ago

Closed by https://github.com/Chilipp/straditize/pull/6